Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import random
- number = random.randint(1,100)
- print(number)
- def guess_game():
- print ("Guess a number game: make a guess between 1 and 100: ")
- guess = int(input("Enter your guess: "))
- count = 0
- while guess != number:
- count = count + 1
- if guess > number:
- print ('your guess is too high. Try again.')
- elif guess < number:
- print ('your guess is too low. Try again.')
- else:
- print("Bingo, that is it.")
- guess = int(input("Guess again: "))
- print("Good job, you got it!")
- print("Guesses taken: ", count)
- guess_game()
Advertisement
Add Comment
Please, Sign In to add comment