mardi 15 novembre 2016

I keep getting a syntax error but cannot figure out where in my code it is happening [on hold]

So basically I had to make a simple guessing game for my basic CompSci class where I use a randint() function after importing the random library. I have to give the person 5 tries and display a message of congratulations and a message of let down depending on if they succeed or fail in 5 tries. It is a simple code but I am having trouble getting it to work. Below is my code:

    import random
    number=random.randint(1,9)
    print("Welcome to the Guessing Game!")
    print("I am going to pick a random number between 1 and 9, you have 5 chances to guess what it is!")

    x=0
    while x<5:
        guess=input(int("Enter your guess: ")
        if int(guess)==int(number)
            print("Wow, that's amazing! Great job!")
            x=x+6    

        elif (int)guess!=(int)number
            x=x+1

        else x==5
            print("I am sorry, none of those guesses were correct. The random number was: ",number,".")

I keep getting a syntax error message but I cannot find why it is appearing that way and giving me the error. I don't know if it is the spacing or if I am doing something wrong. Please help!




Aucun commentaire:

Enregistrer un commentaire