dimanche 25 octobre 2015

What is wrong with my python number guessing script?

I'm trying to make a script that asks a user to guess what number the script is thinking of and then give a response to the user if they want to play again or if they want to quit. I'm using pthon 2.7 and when I run the script it doesn't return any errors but doesn't prompt the first user input.

from random import *

play = 1

while play < 0:
    guess = input("Iam thinking of  number between 1 and 10, what is it?: ")
    numb = randint(1, 10)

    if guess == numb:
        print 'correct, i was thinking of' + str(numb)
        play_again = input("Play again? Y/n")
        if play_again == 'Y':
            play += 1
        elif play_again == 'n':
            play = 0 

    else:
        print "wrong, guess again"
        play_again = input("Play again? Y/n")
        if play_again == 'Y':
            play += 1
        elif play_again == 'n':
            play = 0 




Aucun commentaire:

Enregistrer un commentaire