Created
November 22, 2018 18:41
-
-
Save jasterix/11b8281407561e69b697bab0efe9ad3a to your computer and use it in GitHub Desktop.
StridentPointlessPriorities created by jasterix - https://repl.it/@jasterix/StridentPointlessPriorities
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Hello World program in Python | |
import random | |
secret_number = random.randint(0, 100) | |
guess = -1 | |
counter = 0 | |
while secret_number != guess and counter < 10: | |
guess = int(input("Enter a number: ")) | |
if 0 <= guess <= 100: | |
if guess < secret_number: | |
print("Your guess is low.") | |
elif guess > secret_number: | |
print("Your guess is high.") | |
else: | |
print("You guessed right!") | |
break | |
counter +=1 | |
else: | |
print("Oops! Use a number between 0 and 100.") | |
if counter == 10: | |
print("You lost. The right answer was", secret_number,". Better luck next time!") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment