Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Guess The Number
- import random
- print("I'm thinking of a number between 1 and 100. What is it?")
- #initial values
- the_number = random.randint(1, 100)
- guess = int(input("Take a guess: "))
- tries = 1
- while guess != the_number:
- if guess > the_number:
- print("Lower. ")
- else:
- print("Higher. ")
- guess = int(input("Take a guess: "))
- tries += 1
- print("Correct! The number was", the_number)
- print("It only took you", tries, "tries!")
- input("\n\nPress the enter key to exit.")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement