0

I keep getting a sytax error but i can not find it. It does not highlight the area where it is at. I am still new to programming and need a little help on this one. If you need to see the whole code it is Click Here.

user_input = input('To end this, type Quit: ')

if user_input.lower == 'quit':

elif user_input == '+':
 num1 = float(input.isdigit('Enter your first number here:  '))
 except ValueError:
 print('Not a number, please enter a number')
 num2 = float(input.isdigit('Enter your second number here: '))
 except ValueError:
 print('Not a number, please enter a number')
 total = num1 + num2
 print('Your problem is:' + str(total) + '!')
3
Contributors
4
Replies
23
Views
1 Year
Discussion Span
Last Post by rproffitt
0

Its because Im useing while True and line 4 is where I put the Break in.

0

The except keyword can occur only in a try statement, and must have the same indention as the preceding try.

try:
    statement
    statement
    statement
except ValueError:
    statement
    statement

Also, this is not an error, but the traditional style in python is to indent code with 4 spaces (and not 1 or 2 spaces, an especially no tab characters). Following this rule will help you communicate with other python programmers. You can configure your favorite editor to insert 4 spaces when you hit the tab key.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.