+ 4

elif user_input == "add": num1 = float(input("Enter a number: ")) num2 = float(input("Enter another number: "))

Can anyone tell where the error is

14th Apr 2018, 3:31 PM
Andrew Watts
Andrew Watts - avatar
1 Resposta
- 1
It's hard to know, if you don't give whole code, but from that what you gave: Possible error reasons: 1. There is no if statement, you should use an if statement before using elif statements otherwise it leads to SyntaxError 2. If player uses a string, it will cause a TypeError, when your code trys to conver it to float number. 3. If player input just 1 line of text, it will cause an EOFError 4. if user_input was defined before it was called, it will cause a NameError
14th Apr 2018, 4:36 PM
Seb TheS
Seb TheS - avatar