Skip to content

Instantly share code, notes, and snippets.

@jasterix
Created November 22, 2018 18:41
Show Gist options
  • Save jasterix/11b8281407561e69b697bab0efe9ad3a to your computer and use it in GitHub Desktop.
Save jasterix/11b8281407561e69b697bab0efe9ad3a to your computer and use it in GitHub Desktop.
StridentPointlessPriorities created by jasterix - https://repl.it/@jasterix/StridentPointlessPriorities
# 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