python - Invalid syntax for except ValueError -


when run code (python 3.3):

counter=0 score=0 import random = random.randint(1,25) b = random.randint(1,25) c=a+b try:     answer=int(input("what "+str(a)+" + "+str(b)+" ? ")                     if answer == c:         score=score+1         print("well done!")         print("your score "+str(score)+".")         print("")         counter = counter + 1     else:         print("thats wrong. correct asnwer is: "+str(c)+".")         print("your score "+str(score)+".")         print("")         counter = counter + 1 except valueerror:        print("sadas") 

i says "invalid syntax" , highlight colon "if answer == c:" red.

you missing closing parenthesis:

answer=int(input("what "+str(a)+" + "+str(b)+" ? ")                 #         ^     ^                                    ^? #         |      \----------------------------------/ | #          \-----------------------------------------/ 

Comments

Popular posts from this blog

c++ - QTextObjectInterface with Qml TextEdit (QQuickTextEdit) -

javascript - angular ng-required radio button not toggling required off in firefox 33, OK in chrome -

xcode - Swift Playground - Files are not readable -