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

wireshark - USB mapping with python -

c++ - nodejs socket.io closes connection before upgrading to websocket -

iphone - UIScrolview Prioritize vertical and horizontal scrolling -