import time
def add(numbers):
a = 0
for num in numbers:
a += num
return a
add_numbers = []
def subtract(numbers):
b = 0
for num in numbers:
b -= num
return b
sub_numbers = []
def multiply(numbers):
c = 0
for num in numbers:
c *= num
return c
mul_numbers = []
def divide(numbers):
d = 0
for num in numbers:
d /= num
return d
div_numbers = []
print("What do you want do?")
print("1.Add")
print("2.Subtract")
print("3.Multiply")
print("4.Divide")
time.sleep(1)
print("...")
print("An addition expression is something like 3+5+7 (no spaces)")
print("...")
time.sleep(1)
print("A subtraction expression is something like 3-5-7 (no spaces)")
print("...")
time.sleep(1)
print("A multiplication expression is something like 3*5*7 (no spaces)")
print("...")
time.sleep(1)
print("A division expression is something like 3/5/7 (no spaces)")
print("...")
time.sleep(1)
choice = input("Enter choice(1/2/3/4):")
time.sleep(2)
print("Checking if %s is a valid choice..." % (choice))
print("...")
while 1:
my_string = input("Type in numbers: ")
my_string = my_string.split()
add_numbers = []
for item in my_string:
add_numbers.append(int(item)) # Convert to int and append to add_numbers.
result = add(add_numbers) # add it all up and assign to result.
print ("=" (result))
if add(add_numbers) >= 1000:
break
while 2:
my_string = input("Type in numbers: ")
my_string = my_string.split()
sub_numbers = []
for item in my_string:
sub_numbers.append(int(item)) # Convert to int and append to sub_numbers.
result = subtract(sub_numbers) # add it all up and assign to result.
print ("=" (result))
if subtract(sub_numbers) >= 100:
break
while 3:
my_string = input("Type in numbers: ")
my_string = my_string.split()
mul_numbers = []
for item in my_string:
mul_numbers.append(int(item)) # Convert to int and append to my_numbers.
result = multiply(mul_numbers) # add it all up and assign to result.
print ("=" (result))
if multiply(mul_numbers) >= 10000:
break
while 4:
my_string = input("Type in numbers: ")
my_string = my_string.split()
div_numbers = []
for item in my_string:
div_numbers.append(int(item)) # Convert to int and append to my_numbers.
result = divide(div_numbers) # add it all up and assign to result.
print ("=" (result))
if divide(div_numbers) >= 100:
break