python - Syntax error on line containing if statement -


i keep trying make simple guess number game python keeps saying code has syntax error. doing wrong?

import random takeone = input("guess number between 1 & 5") numberinit = random.randint(1,5) if "takeone" == "numberinit"     print("your right") else:     print("your wrong") 

the syntax error you're getting following:

  file "test.py", line 4     if "takeone" == "numberinit"                                ^     syntaxerror: invalid syntax 

this means you're missing colon @ end of if line. line should instead read:

if "takeone" == "numberinit": 

Comments

Popular posts from this blog

javascript - Laravel datatable invalid JSON response -

java - Exception in thread "main" org.springframework.context.ApplicationContextException: Unable to start embedded container; -

sql server 2008 - My Sql Code Get An Error Of Msg 245, Level 16, State 1, Line 1 Conversion failed when converting the varchar value '8:45 AM' to data type int -