0
Why do I get this error someone explain please? Syntax Error - result = str(num1 / num2)
When code is ran i get an Syntax Error highlighting "result". Any suggestions? Thanks in advance. elif user_input == "divide": num1 = float(input("Enter a number: ")) num2 = float(input("Enter another number: ") result = str(num1 / num2) print("The answer is: " + result)
6 Answers
+ 2
it's highlighting result because you didn't close the previous line.. add ) to the end of num2
+ 2
#justin your ans is right
0
Damn haha thanks a lot.
0
no problem, I've had the same problem many times lol
0
its first changing num1 & num 2 in string and then dividing . but string cant be devided . so it shows error
0
I thought that too Rohan, but it is turning the number after division into a string.. it's wierd, but it works