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) + '!')

Recommended Answers

All 4 Replies

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

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.

@Violated. Line 4 shows nothing. If you post incomplete code, you risk incomplete answers.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.