0
problem :p
x=input("enter first number: ") print(x) y=input("enter second number: ") print(y) print(" press 1 For Addition") print("press 2 for subtraction") print("press 3 for multiplication") print("press 4 for division") choice=input("Enter the choice : ") print(choice) if choice=='1': result=x+y print("your answer is: ") print(result) elif choice=='2': result=x-y print("your answer is: ") print(result) elif choice=='3': result=x*y print("your answer is: ") print(result) elif choice=='4': result=x/y print("your answer is: ") print(result) else: print("Are you mad?") quit() i have made this, but instead of addition it combines the numbers :(
1 ответ
+ 1
You have to convert the input from a string to a number before using it.
x=float(input("enter first number: "))
...
y=float(input("enter second number: "))
...