hi guys.
just started to work with python, first time programming.
anyway, I got a task to build a simple calculator, that can use the operators (*,-, + , / , ^ )
attached the code here:
any suggestions? and i use Spyder 4 (also tried it in an online reader)
just started to work with python, first time programming.
anyway, I got a task to build a simple calculator, that can use the operators (*,-, + , / , ^ )
attached the code here:
while True: print("welcome to Yotaam's math") print("enter 'add' to add two numbers") print("enter 'mtpy' to multiply two numbers") print("enter 'sub' to suctract two numbers") print("enter 'dvd' to divide two number") print("enter 'pwr' to put a number in the power of a second number") print("enter 'quit' to end the program") input(":") if input() == "quit": break elif input == "add": num1 = float(input("type first number :")) num2 = float(input("type second number:")) rslt = num1 + num2 print ("The result is:" + rslt) elif input == "mtpy": num1 = float(input("type first number")) num2 = float(input("type second number:")) rslt = num1 * num2 print ("The result is:" + rslt) elif input == "sub": num1 = float(input("type first number:")) num2 = float(input("type second number:")) rslt = float(num1 - num2) print ("The result is:" + rslt) elif input == "dvd": num1 = float(input("type first number:")) num2 = float(input("type second number:")) rslt = num1 / num2 print ("The result is:" + rslt) elif input == "pwr": num1 = float(input("type first number:")) num2 = float(input("type second number:")) rslt = num1 ^ num2 print ("The result is:" + rslt) else: print ("unknown input, try again")For some reason, when i run the program, i get the : instruction. when i type in when of the options i made i get an empty screen instead of an input option.
any suggestions? and i use Spyder 4 (also tried it in an online reader)