alright, So I'm working on a small python Command-line calculator,
this was just a test:
import time
calc = print("\n what calculation do you want to use\n")
time.sleep(1)
menu = print(" MENU:\n **********\n mult for multiplication\n add for addition\n sub for substraction\n div for divide\n **********")
time.sleep(1)
ask = input(" what calculation do you want to use from the menu? \n")
much = input(" how many numbers do you calculate? (5 maximumn & 2 minimum) \n")
if(much == " 2" or much == "2" and ask == " mult" or ask == "mult"):
num1_2 = input(" First Number? ")
num2_2 = input("\n Second Number? ")
answer_2 = print(int(num1_2) * int(num2_2))
time.sleep(11)
and it was working correctly, i was planning to complete all the if:
and the elif:
statements,
but then i thought that i could make my code more efficient, so i thought i can use a for
loop
like this:
for value in range(int(much)):
output = input("Number? ")
print(int(value) * int(value))
note: (much) is the the variable name that i used for declaring how many numbers does the user wants to calculate
so, when i used the for loop it showed a wrong answer, for example when i multiplied 2 by 2 the answer was 1.
so how can i declare multiple items in the for
loop to multiplie the first user input by the second one?
this is confusing because the number of outputs is not stable.