+ 1

float object not callable

So I am trying to make my own calculator but every time I execute the code, i keep getting an error saying: print("Options:") TypeError: 'float' object is not callable. Here is my code: while True: print("Options:") print("Enter 'add' to add two numbers") print("Enter 'subtract' to subtract two numbers") print("Enter 'multiple' to multiply two numbers") print("Enter 'divide' to divide two numbers") print("Enter 'quit' to end the program") user_input = input(":") if user_input == "quit": break elif user_input == "add": print("Enter numbers for addition") nums1 = float(input("Enter number:")) nums2 = float(input("Enter number:")) Result = (nums1 + nums2) print = (Result)

9th Jun 2019, 2:48 PM
Mars_96
3 Antworten
+ 7
print(Result) instead of print = (Result)
9th Jun 2019, 2:52 PM
Anna
Anna - avatar
+ 6
problem is the last line in code: print = (Result) correct statement should be: print(Result)
9th Jun 2019, 3:02 PM
Lothar
Lothar - avatar
+ 2
ah thanks anna, i cant believe i didn’t see something so obvious haha
9th Jun 2019, 2:57 PM
Mars_96