text stringlengths 37 1.41M |
|---|
function train returns an error value
inputs: the network, the input values (x), the desired output values (d), learning rate.
let y be the output layer
let error be the error value
let f() be the outputFunction.
let f'() be the derivative of f().
feedforward(x);
/* Calculate errors */
For each node n in the y do
... |
ciclo = True
for i in range ( 0 , 100 ):
residuo = i**3 % 9
if ( residuo == 8 ):
residuo = -1 ;
if ( residuo % 3 == 0 and residuo != 0 ):
ciclo = False
if ( residuo % 3 == 1 and residuo != 1 ):
ciclo = False
if ( residuo % 3 == 2 and residuo != -1 ):
ciclo = False
print ( resid... |
"""Выводит число Фибоначчи с индексом n"""
a = int(input('Enter index of Fibonacci number '))
print(round((((1+(5 ** 0.5))/2) ** a)/(5 ** 0.5)))
### ну прочитай для начала, что такое числа фиббоначи ### |
def make_matrix():
size = int(input())
matrix = []
for s in range(size):
rows = input()
rows_to_append = []
for r in rows:
rows_to_append.append(r)
matrix.append(rows_to_append)
return matrix
def is_valid(row, col):
if 0 <= row < len(matrix) and 0 <= col... |
def flights(*args):
values = list(args)
dict_for_flights = {}
while len(values):
current_destination = values[0]
if current_destination == "Finish":
break
people = values[1]
if current_destination in dict_for_flights.keys():
dict_for_flights[current_de... |
# 반복문 붙여서 1번 커밋, 조건문(짝수일 때만 프린트) 1번 커밋
for i in range(1,20+1):
if i%2==0:
print("It works!!")
|
def press_grind_beans(): # def defines the function, it is a container for a specified code block
print("Griding for 20 seconds")
press_grind_beans()
# paramaters give functions thier flexibility using .format(variables)
def cash_withdrawal(amount,accnum):
print("Withdrawing £{}.00 from {}".format(amount,accnu... |
print("Hello, World!")
print("I love Farah Mustapha!")
print("Okay, thanks. Bye!")
# the above line are test strings for the print function
# data types in python include strings "", integers int or float, functions like print
int = 1 # a ssigns integer to 1
float = 1.01234 # assingns float to 1.01234
print(int, float)... |
import sys
import random
import time
def get_words_list(filename):
pass
def create_sentence(num_of_words):
'''Create a sentence given number of words in sentence'''
#Open corpus
with open('american') as f:
word_list = list(f)
word_ct = 0 #Words generated
sentence = ""
... |
x = 5
while x < 10:
print('x小于十!')
print('我还在框框里')
x = x + 1
print('我逃出回圈了') |
tabuada = int(input('Digite um número para apresentar a tabuada: '))
for n in range(1, 11):
print(' {} x {:2} = {}'.format(tabuada, n, n * tabuada))
|
metros = float(input('Informe a quantidade em metros que deseja converter: '))
centimetros = metros * 100
milimetros = metros * 1000
print('Com base em {} metros, teremos \n Centimentros {} \n Milímetros {}'.format(metros, centimetros, milimetros))
|
velocidade = float(input('Informe a velocidade atual do carro: '))
if velocidade > 80:
multa = (velocidade - 80) * 7
print('Multado!\nVocê excedeu o limite permitido de 80Km/h\nVocê deve pagar uma multa de R$ {:.2f}'.format(multa))
print('Tenha um bom dia!\nDirija com segurança!')
|
c = float(input('Informe a temperatura em ºC: '))
f = (c * (9/5)) + 32
print('A temperatura em Fahrenheit será de {}ºF'.format(f)) |
numero = int(input('Digite qual número deseja calcular seu fatorial: '))
c = numero
f = 1
print('Calculando {}! = '.format(numero), end='')
while c > 0:
print('{}'.format(c), end='')
print(' x ' if c > 1 else ' = ', end='')
f *= c
c -= 1
print('{}'.format(f))
|
vlCasa = float(input('Informe valor da casa R$ '))
salario = float(input('Informe salário mensal R$ '))
anos = int(input('Informe quantos anos deseja financiar: '))
prestaçao = vlCasa / (anos * 12)
maxPrestaçao = salario * 0.30
if prestaçao >= maxPrestaçao:
print('Empréstimo NEGADO! \nInfelizmente o valor da prest... |
value = int(input("Podaj numer "))
for x in range(1,value):
if value%x == 0:
print(x) |
import random
number = input("猜猜我心里的数字是几:")
numberInt = int(number)
if isinstance(numberInt, int) == True:
numberR = random.randint(1,10)
i = 0
while numberInt != numberR and i < 3:
if numberInt == numberR:
print("对了!")
else:
print("错了!应该是:" + str(numberR))
... |
# Request user input the first time
def start():
print("1: Random")
print("2: Random + Hill climbing")
print("3: Random + Simulated annealing")
print("4: Greedy")
print("5: Greedy + Hill climbing")
print("6: Greedy + Simulated annealing")
# let user choose the algorithm
chosen_algorithm... |
# -*- coding:UTF-8 -*-
# 3.6.1
import math
class PlusOne:
def change(self, array):
num = 1
for i in range(len(array)-1, -1, -1):
a = array[i] + num
array[i] = a % 10
num = math.floor(a / 10)
if num == 1:
array.insert(0, 1)
ret... |
# 3.6.1
# -*- coding:UTF-8 -*-
class PowerOfTwo:
def solve(self, num):
return num > 0 and not (num & (num-1))
powerOfTwo = PowerOfTwo()
print(powerOfTwo.solve(3))
print(powerOfTwo.solve(4))
'''
def solve(self, num):
return num > 0 and (num % 2 == 0)
'''
|
def showSquare(n):
i = 0
while (i < n):
newString = " " * (2*n+1) + "*" * (2*n)
print(newString)
i = i + 1
j = 1
while j < 10:
showSquare(j)
print(" ")
j = j + 2 |
usercommand = ""
while True:
usercommand = input("Enter your command: ")
if usercommand == "exit":
break
print("running your command sir")
if usercommand == "stars":
print("****************")
elif usercommand == "dashes":
print("----------------")
else:
print("nothing for you")
print("program end")
|
def isPalindrome(s):
i = 0
j = len(s) - 1
while i <= j:
if s[i] == " ":
i = i + 1
continue
if s[j] == " ":
j = j - 1
continue
if s[i] != s[j]:
return False
i = i + 1
j = j - 1
return True
print(isPalindr... |
num = int(input("enter a number:"))
isPrime = True
for n in range(2, num):
if (num % n) == 0:
isPrime = False
break
if isPrime == True:
print("yes")
else:
print("no") |
num1 = int(input("enter a number:"))
num2 = int(input("enter a number:"))
smaller = min(num1, num2)
for i in range(smaller, 0, -1):
if (num1 % i == 0) and (num2 % i == 0):
print(i)
break
|
def convert_to_tuple(list_input):
tuple_out = tuple(list_input)
return tuple_out
my_list = ['a', 'b', 1, 2, 'c', 'd', 3, 4]
print(convert_to_tuple(my_list))
|
list_1 = [1, 3, 5, 7, 9, 10]
list_2 = [2, 4, 6, 8]
list_1.pop(-1)
new_list = list_1 + list_2
print(new_list)
|
input_list = []
if len(input_list) == 0:
print("List is empty")
else:
print("List is not empty") |
def check_in_range(input_range, num):
if int(num) in range(int(input_range[0]), int(input_range[1])):
return True
else:
return False
num_range = input("Enter Number range(eg. 4-10): ")
number = input("Enter the number: ")
range_list = (num_range.split("-"))
print(check_in_range(range_list, num... |
def delete_from_tuple(input_tuple, item_to_remove):
input_list = list(input_tuple)
input_list.remove(item_to_remove)
tuple_out = tuple(input_list)
return tuple_out
my_tuple = ('a', 'b', 'c', 'd', 'e', 'f')
print(delete_from_tuple(my_tuple, 'a'))
print(delete_from_tuple(my_tuple, 'e'))
|
import math
def find_product(input_list):
return math.prod(input_list)
my_list = [8, 2, 3, -1, 7]
print(find_product(my_list))
|
input_dict = {1: 10, 2: 20, 3: 30, 4: 40, 5: 50, 6: 60}
for item in input_dict:
print("Key:", item, end=" ")
print("Value:", input_dict.get(item))
|
filename = input("filename : ")
output = filename.split(".")[-1]
if output == 'py' :
print('Python')
elif output == 'c':
print('C language')
elif output == ('CPP'):
print('C++')
else :
print('unknown extention')
|
class Solution:
"""
@param year: a number year
@param month: a number month
@return: Given the year and the month, return the number of days of the month.
"""
def getTheMonthDays(self, year, month):
# write your code here
normal_days = [-1, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31... |
# 反转链表
class ListNode:
def __init__(self, x):
self.val = x
self.next = None
class Solution:
def reverseList2(self, head: ListNode, tail=None) -> ListNode:
if head:
head.next, tail, head = tail, head, head.next
return self.reverseList2(head, tail) if head else tail
... |
# 两两交换链表节点
class Solution:
def swapPairs(self, head):
if head and head.next:
head.next.next, head.next, head = head, self.swapPairs(head.next.next), head.next
return head
# if not head or not head.next:
# return head
# nxt = head.next
# head.next = s... |
from pprint import pprint
class Solution(object):
def uniquePaths(self, m, n):
"""
:type m: int
:type n: int
:rtype: int
"""
# if m<2 or n <2:
# return 0
f = [[1] * n] + [[1] + [0] * (n - 1) for _ in range(m - 1)]
for i in range(1, m):
... |
# 字母异位词分组
import collections
from typing import List
class Solution:
def groupAnagrams(self, strs: List[str]) -> List[List[str]]:
mp = collections.defaultdict(list)
for st in strs:
key = "".join(sorted(st))
mp[key].append(st)
return list(mp.values())
def grou... |
class compare(str):
def __lt__(x, y):
return x + y > y + x
class Solution:
def largestNumber(self, nums):
largest = sorted([str(v) for v in nums], key=compare) # 排序
print(largest)
largest = ''.join(largest) # 转换字符串
return '0' if largest[0] == '0' else largest # 如果第一... |
def BubbleSort(numList):
if not numList:
return
isSwap = True
n = len(numList)
for i in range(n):
isSwap = False
j = n - 1
while j > i:
if numList[j] < numList[j - 1]:
numList[j], numList[j - 1] = numList[j - 1], numList[j]
isSw... |
class Solution:
def searchInsert(self, nums, target):
if not nums:
return 0
prev = -1
for i, val in enumerate(nums):
if val == target:
return i
elif val < target:
prev = i
else:
return prev + 1
... |
from typing import List
# 此题product 函数的使用 或者确切是类使用
class Solution:
def letterCombinations(self, digits: str) -> List[str]:
from itertools import product
l = '- - abc def ghi jkl mno pqrs tuv wxyz'.split()
return [''.join(c) for c in product(*[l[int(i)] for i in digits])] if digits else [... |
#SURBHI BABBAR
#16csu376
#OBJECTIVE: automation of mouse pointer
#DESCRIPTION: it basically automates some of the applications
#eg:there are 5 buttons in gui as follows:
#1:facebook: it opens browser and automatically opens facebook account
#2:chrome:opens chrome
#3:music:plays music from library
#4:recycle bin:shows d... |
import json
import datetime
def load_days():
with open('data.json') as days_of_week:
days = json.load(days_of_week)
return days
weekdays = []
days = load_days()
def str_to_time(string):
i = 1
j = 1
flot = string[0]
while(i < len(string)):
if(string[i] == ":"):
whil... |
nums = input("1 Enter a sequence of comma separated numbers \n")
theList = nums.split(',')
print(theList)
### convert list to tuple
theTuple = ()
for i in theList:
theTuple |
"""
This bot looks ahead "lookahead" moves to make sure the game continues that number of turns
That for the move that the bot is currently playing, both players have a move they can continue to play.
"""
from abstract_no_tipping_player import Player
# fixed
BOARDLENGTH = 30 # half the board length
BOARDWEIGHT = 3
... |
import abc
class Player(object, metaclass=abc.ABCMeta):
@abc.abstractmethod
def placeBlock(self) -> dict:
raise NotImplementedError('placeBlock not defined')
@abc.abstractmethod
def removeBlock(self) -> int:
raise NotImplementedError('removeBlock not defined')
"""
Returns a dict... |
#!/usr/bin/python
"""
Starter code for the regression mini-project.
Loads up/formats a modified version of the dataset
(why modified? we've removed some trouble points
that you'll find yourself in the outliers mini-project).
Draws a little scatterplot of the training/testing data
You fi... |
a=8
b=9
a,b=b,a
print(a)
print(b)
a=2
b=3
a=a+b
b=a-b
a=a-b
print (a)
print(b)
a=3
b=5
temp=a
a=b
b=temp
print(a)
print(b)
|
import cv2 as cv
import numpy as np
import matplotlib.pyplot as plt
img = cv.imread('photos/boston.jpeg')
cv.imshow('boston', img)
gray = cv.cvtColor(img, cv.COLOR_BGR2GRAY)
cv.imshow('Gray',gray)
# There are two other ways to compute edges in an image other than canny
# 1: Laplacian
lap = cv.Laplacian(g... |
import cv2 as cv
import numpy as np
import matplotlib.pyplot as plt
# Thresholding is binarization of an image
# In general, we take an image and convert it into a binary image
# i.e where pixels are either 0 (black) and 255 (white)
# set up a threshold value, if the intensity of the pixel is less than threshol... |
#https://www.hackerrank.com/challenges/validating-the-phone-number
n = int(input())
for _ in range(n):
a = input()
if len(a) == 10 and (a.startswith("7") or a.startswith("8") or a.startswith("9")) and a.isdigit():
print("YES")
else:
print("NO")
|
from random import randint
o = ['r', 's','p']
countU = 0
countC = 0
x = True
while x:
ch = randint(0,2)
choice = input("Your turn r/s/p: ")
if o[ch] == choice:
print('tie\n')
elif o[ch] == 'r' and choice == 'p':
print(o[ch])
countU += 1
print('You got a point!\... |
#Name: Nick Wolf
#week 14 assignment1
#States in alphabetic order
#States file (open, alphabetize, close)
def function1 ():
#open file
States_file = open ('statesnames.txt', 'r')
#readfile alphabetically
States_alphabet = sorted(States_file.readlines())
#close file
States_file.... |
"""A module with functions for word counting."""
import re
def count_words(sentence):
"""Count the words in a the given sentence."""
words = map(
lambda s: s.strip("'"),
re.split(
r'[\s,_]',
re.sub(r'[!&@$%^.:"]', '', sentence).lower()
)
)
counts = {}
... |
# Update street name
def update_name(name, mapping):
for key in mapping:
if key in name:
name = string.replace(name,key,mapping[key])
return name
# Update zipcodes
def update_zipcode(zipcode, mapping):
for key in mapping:
zipcode = string.replace(zipcode, key,mapping[ke... |
# func to find prime nums
import timeit
start = timeit.default_timer()
def prime(num):
if num == 1:
return False
elif num == 2:
return True
sqr = num**0.5 + 1
firs = 2
while firs < sqr:
if num % firs == 0:
return False
firs += 1
return True
def nex... |
import itertools
def prime(num):
if num == 1:
return False
if num == 2:
return True
i = 2
num2 = num**0.5 + 1
total = 0
while i <= num2:
if num%i == 0:
total += 1
break
i += 1
if total == 1:
return False
else:
retur... |
def prime(num):
i = 2
total = 0
while num/2 > i > 1:
if num%i == 0:
return False
i += 1
return True
def sum_of_divisors(num):
i = 1
total = 0
while i <= num / 2:
if num%i == 0:
total += i
i += 1
return total
def amicable(num):
... |
def digitsum(num):
total = 0
for i in str(num):
total += int(i)
return total
def prime(num):
if num == 1:
return False
if num == 2:
return True
sq = num**0.5 + 1
i = 1
while i <= sq:
if num%i == 0:
return False
return True
def harshad(... |
#input for price
CAR_PRICE = float(input("Enter the original price of the automobile: "))
#validate price
while CAR_PRICE <= 0:
CAR_PRICE = float(input("Enter the original price of the automobile: "))
#input for years
NUM_YRS = int(input("Enter number of years: "))
#validate years
while NUM_YRS <= 0:
NUM_YR... |
# -*- coding: utf-8 -*-
"""
Created on Fri Feb 23 16:37:09 2018
@author: ASUS
"""
def leap_year(year):
# 1700,1800,1900 is divisible by 4 but not a leap year
if year%4 != 0:
return False
elif year%100 != 0:
return True
elif year%400 != 0:
return False
else:
return T... |
def countVowels(S):
total_size = len(S)
vowels = 0
for char in S:
if char in 'aeiouAEIOU':
vowels = vowels + 1
consonants = total_size - vowels
if vowels > consonants:
print('There are more vowels than consonants in the string ' + S)
elif vowels == consonants:
... |
n=int(input("Enter a no:"))
a=0
b=1
print(a)
sum=a+b
print(sum)
for i in range(n):
c=a+b
a=b
b=c
print(c)
|
class Node:
def __init__(self, dataval):
self.dataval = dataval
self.nextval = None
self.preval = None
class CLinkedList:
def __init__(self):
self.headval = None
def AtBeginning(self, newdata):
if self.headval == None:
NewNode = Node(newdata)
... |
import imdb # importing the module
ia = imdb.IMDb() # creating instance of IMDB
print("=======================")
name = input("Enter movie, tv series name : ") # movie name
search = ia.search_movie(name) # searching the movie
lst = list() # defining a list
lst1 = l... |
def nth_prime(n):
primes = [2]
odd = 3
while len(primes) < n:
for i in primes:
if odd % i == 0:
break
else:
primes.append(odd)
odd += 2
return primes[-1]
if __name__ == '__main__':
n = int(input("Enter nth"))
print("Prime is {v... |
def login():
while True:
login_temp = input('Enter your login: ')
if login_temp in credentials:
if input('Enter the password: ') == str(credentials[login_temp]):
logged_in()
return False
else:
print('Incorrect password... |
import random
def checkletter(letter):
if len(letter) != 1:
print('Incorrect input. Please enter only one letter.')
else:
for i in range(len(myword)):
if letter == myword[i]:
blankword[i] = letter
print(*blankword, sep=' ')
words = open('words.t... |
a=int(input())
b=int(input())
c=int(input())
if a > b and a > c and b < a and b < c:
print (a)
print (b)
print (c)
elif a == c and c > b and a > b:
print (a)
print (b)
print (c)
elif a == b and b > c and a > c:
print (a)
print (c)
print (b)
elif b == c and b >... |
n = int(input())
a='*'
while len(a) <= n:
print (a)
a += '*'
|
#!/usr/bin/python3
import sys
def main():
indata = sys.stdin.readline().strip().split(' ')
month = indata[0]
day = int(indata[1])
if (month == "DEC" and day == 25) or (month == "OCT" and day == 31):
print("yup")
else:
print("nope")
main() |
# Part 1:
students = [
{'first_name': 'Michael', 'last_name' : 'Jordan'},
{'first_name' : 'John', 'last_name' : 'Rosales'},
{'first_name' : 'Mark', 'last_name' : 'Guillen'},
{'first_name' : 'KB', 'last_name' : 'Tonel'}
]
def printStudents ():
for i in students:
print(i["first_name"] +... |
import copy
import unittest
class Graph:
def __init__(self, num_nodes, num_edges, edges):
self.graph = dict()
for i in range(num_nodes):
self.graph[i] = []
for i in range(num_edges):
n0, n1 = edges[i]
self.graph[n0].append(n1)
self.gr... |
Dict = {1:'hello',2:'world',3:'john',4:'pagal'} # create dictionary
print(Dict.keys()) #priting Keys Only
print(Dict.values()) #printing Values Only
print(Dict) # Printing Both keys and Vlaues
#with Strings
thsdict = {
'brand':'ford',
'model':'mustang',
'year':1966
}
thsdict['year']=2018
print(thsdict['y... |
#modules containing python code statement and definations
'''
it will use to divide file and create segmantes in python programming
it will use import function to get data
import Example
Example.addition(10,20) #error is here
#import using system define and user define
import math
print('The value of PI is: ',m... |
number = int(input('Enter a Number: '))
i = 0
fibo = 1
s = 0
print('Series is: ')
while s < number:
print(i)
Temp = i + fibo
i = fibo
fibo = Temp
s += 1
|
list1 = [1, 2, 3, 4]
list1.remove(1)
print(list1)
# removes 'a' from list2
list2 = ['a', 'b', 'c', 'd']
list2.remove('c')
print(list2) |
"""stackable_iterator module."""
class Stackerator(object):
"""
Iterator that supports push operations, like a stack.
The last element to be pushed to the iterator is the next element out.
"""
def __init__(self, it):
"""Instantiate object."""
self.it = it
# See if there a... |
# -*- coding: utf-8 -*-
"""
@project: Sorting-Algorithms
@version: v1.0.0
@file: selection_sort.py
@brief: Selection Sort
@software: PyCharm
@author: Kai Sun
@email: autosunkai@gmail.com
@date: 2021/8/1 21:41
@updated: 2021/8/1 21:41
"""
def selection_sort(arr):
for i in range... |
# -*- coding: utf-8 -*-
"""
@project: Sorting-Algorithms
@version: v1.0.0
@file: merge_sort.py
@brief: Merge Sort
@software: PyCharm
@author: Kai Sun
@email: autosunkai@gmail.com
@date: 2021/8/3 22:56
@updated: 2021/8/3 22:56
"""
def merge_sort(arr):
def mergesort(l, r):
... |
# my own Solution
###------------------------------------------------
# def is_leap_year(year):
# if year % 400 == 0:
# return True
# elif year % 100 == 0 and year % 4 == 0:
# return False
# elif year % 4 == 0:
# return True
# else:
# retur... |
def binary_search(arr,key):
low = 0
high = len(arr)-1
while low <= high:
mid = (low+high)//2
if arr[mid] < key:
low = mid+1
elif arr[mid] > key:
high = mid-1
else:
return mid
return False
arr = [1,2,3,4,5,6,7,8,9]
k... |
def printRain():
weekdays = ["Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"]
rain = [1, 2, 3, 4, 5, 6, 7]
for day in rain:
print(weekdays[day-1], rain[day-1]) |
from pprint import pprint
ogrenciler = {}
ogrenciler['1'] = {
"isim": "Sezer",
"soyisim": "Bozkir"
}
for ogr_no in range(3):
if ogr_no not in ogrenciler.keys():
isim = input(f"{ogr_no+1}. ogrencinin ismi?")
soyisim = input(f"{ogr_no+1}. ogrencinin soyisim?")
ogrenciler[ogr_no+1] = {
... |
num1 = 10
num2 = 15
print(num1 > num2)
print(num2 > num1)
print(5 == 6)
print(5 == 5)
print(5 != 6)
print(5 >= 6)
print(6 >= 6)
print(5 <= 6)
print(True and False)
print(True and True)
print(False and False)
print(True or True)
print(True or False)
print(False or False)
print(not True)
print(not False)
|
"""The executable file to run the pathfinder module.
file: __main__.py
Authors:
- Jurre Brandsen
- Lennart Klein
- Thomas de Lange
Pathfinder will find the most efficient path between two gates on a board.
"""
# def main():
"""Main function to execute the pagage."""
import sys
import colors as CLR
impo... |
import random
welcome = ''
yes_roll = 'r'
exit_roll = 'exit'
welcome_sum = 0
acum = 0
while welcome != 'exit':
welcome = input("Roll the dice (press r to roll or type 'exit' to quit): ")
if welcome == yes_roll.lower():
welcome = random.randint(1, 6)
print('You rolled: ', welcome)
... |
resultados = []
def mostras_resultados():
for item in resultados:
print(item)
mostrar_menu()
def area_cuadrado():
lado=input('lado del cuadrado')
lado=int(lado)
a=lado*lado
resultados.append(f'Area de un cuadra {a}')
print(a)
def area_rectangulo():
base=input('Base del Rect... |
from sys import exit
from random import randint
class Game(object):
def __init__(self, start):
self.quips = ["you died", "your proud", "such", "I puppy"]
self.start = start
def play(self):
next = self.start
while True:
print "\n-------"
room = geta... |
#!/usr/bin/env python
# coding=utf-8
class PrintTable(object):
def __init__(self):
print('乘法口诀:\n')
self.print99()
def print99(self):
for i in range(1, 10):
for j in range(1, i+1):
print('%dx%d = %2s ' %(j, i, i*j)),
print('\n')
if __name__ == ... |
# --------------
# User Instructions
#
# Write a function, compile_word(word), that compiles a word
# of UPPERCASE letters as numeric digits. For example:
# compile_word('YOU') => '(1*U + 10*O +100*Y)'
# Non-uppercase words should remain unchaged.
# My answer:
def compile_word(word):
"""Compile a word of upperca... |
#!/usr/bin/env python3
import sys
def social():
so = saraly*0.165
print(int(so))
def tax(salary):
if salary <= 5000:
tax = (salary-social()-3500)*0.30
elif salary <=8000:
tax = (salary-socila()-3500)*0.10-105
elif salary<=12500:
tax = (salary-social()-3500)*0.20-555
eli... |
final=int(input("ingresa un valor decimal entero menor a 100: "))
n=0
while n<=final:
if(n%2==0):
print("es numero par " +str(n))
else:
print("es numero impar "+str(n))
n=n+1 |
from typing import Optional, List, TypeVar, Generic
T = TypeVar("T")
class Stack(Generic[T]):
def __init__(self) -> None:
self.__container: List[T] = list()
def append(self, item: T) -> None:
self.__container.append(item)
def pop(self) -> Optional[T]:
return self.__container.pop... |
from tkinter import *
def ClickButton(numbers):
global operator
operator = operator + str(numbers)
text_Input.set(operator)
def ClearButton():
global operator
operator=""
text_Input.set(operator)
def EqualButton():
global operator
operator=str(eval(operator))
text_Input.set(operat... |
# NUMBER FROM 1 TO 100
# CALCULATE FIZZ, BUZZ, FIZZBUZZ AMOUNT and TOTAL
fizz = 0
buzz = 0
fizzbuzz = 0
for i in range(1, 100):
if i % 3 == 0 and i % 5 == 0:
print("FIZZBUZZ")
fizzbuzz += 1
elif i % 3 == 0:
print("FIZZ")
fizz += 1
elif i % 5 == 0:
print("BUZZ")
... |
# script edad
#Escriba que teniendo en cuenta el año actual, solicite a un usuario
#por consola: el nombre y el año de nacimiento, y le muestre por pantalla un mensaje
#indicando el nombre ingresado y la edad actual.
Año=2020
A_nacimiento=0
Edad=0
print ("ingrese su nombre")
Nombre = input()
print ("escriba su año de ... |
Num1=45
Num2=23
resta=0
resta= Num1-Num2
print ("el resultado de la resta es ", resta)
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.