Upload code
This commit is contained in:
39
IO/Idioms.py
Executable file
39
IO/Idioms.py
Executable file
@@ -0,0 +1,39 @@
|
||||
#Idioms
|
||||
import random
|
||||
|
||||
#Check user input
|
||||
s = 200
|
||||
|
||||
while (s < 1) or (s > 99):
|
||||
s = int(input("Zahl: "))
|
||||
if (s < 1) or (s > 99):
|
||||
print("Number not within designated range. Try again")
|
||||
|
||||
print("Ok")
|
||||
|
||||
|
||||
#Find biggest number
|
||||
output = 0
|
||||
for i in range(100):
|
||||
n = random.randint(1, 1000)
|
||||
if n > output:
|
||||
output = n
|
||||
|
||||
print(output)
|
||||
|
||||
|
||||
#Summ up
|
||||
summ = 0
|
||||
for i in range(100):
|
||||
n = random.randint(1, 1000)
|
||||
summ += n
|
||||
|
||||
print(summ)
|
||||
|
||||
|
||||
#even or uneven?
|
||||
z = random.randint(1, 1000)
|
||||
if (z % 2) == 1:
|
||||
print("odd")
|
||||
else:
|
||||
print("even")
|
||||
Reference in New Issue
Block a user