Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from random import randint
- number = randint(1,100)
- def findnumber():
- guess = input("Guess a number between 1 and 100: ")
- tries = 0
- if guess == number:
- tries += 1
- print "You won!"
- print tries
- elif guess < number:
- print "Guess higher!"
- tries += 1
- findnumber()
- elif guess > number:
- print "Guess lower!"
- tries += 1
- findnumber()
- else:
- pass
- print findnumber()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement