python - The shell says 'Invalid Syntax' -


    #this loop try statement until integer entered guess1 variable     while true:         #the try statement see if guess variable given integer value,         #if not print "you did not enter integer. not         #valid answer         try:             #this allow user enter answer ,             #store in guess1 variable             guess1 = int(input(""))             #this break while loop if integer entered guess1 variable             break         except valueerror:             print("you did not enter integer. not valid answer. please enter valid integer")             print("answer quesiton appropiately" + "what " + (str(first2) + op + str(second2) + "?")     if guess1 == answer1:         #if guess1 variable equal answer1 variable,         #"correct!" printed , 1 point         #added score         print("correct!")         score += 1     else:         #else "incorrect" printed         print ("incorrect") 

the shell states there invalid syntax colon when typed 'guess1 == answer1:'.

the problem didn't close tag on second line in except statement. add ")" end.

print("answer quesiton appropiately" + "what " + (str(first2) + op + str(second2) + "?")) 

Comments

Popular posts from this blog

Payment information shows nothing in one page checkout page magento -

tcpdump - How to check if server received packet (acknowledged) -