Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import random
- name = input("What is your name?")
- print("Hello " + name + ". Let's play a game.")
- while True:
- secret = random.randint(1, 101)
- while True:
- guess = int(input("Choose a number from 1 to 100:"))
- if guess == secret:
- print("Congratulations!")
- break
- elif guess < secret:
- print("The number is higher")
- else:
- print("The number is smaller")
- play = input("Play another game?")
- if play == "yes" or play == "Yes":
- continue
- else:
- print("Bye!")
- break
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement