Python Forum

Full Version: Invalid syntax on IF function
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
guessnumber=0

import random
Mystery = random.randint(0,9)

while guessnumber==int(input("Guess a number between 0-9: ")):
    if guessnumber > Mystery:
        print('The number you input is not the mystery number, try again.')
    guessnumber = int(input("Enter a guess: ")
if guessnumber == Mystery:
 print("you win!")
Error:
invalid syntax
This is what I did, but the error that i'm REALLY struggling with is that it always says invalid syntax in the end of the function IF which is obviously the colon, I need help with this.
You miss a bracket in prev. line.
(Jan-07-2018, 02:44 AM)wavic Wrote: [ -> ]You miss a bracket in prev. line.
Thanks.
Just a silly mistake.
Please, always post full Traceback in error tags, not just the last line.