Skip to content

Instantly share code, notes, and snippets.

@tommy-mor
Forked from Shamrock-Frost/Cathals_First_Game.py
Created July 31, 2018 17:01
Show Gist options
  • Save tommy-mor/a0fada6c7a20fd21693030338f9fcdf0 to your computer and use it in GitHub Desktop.
Save tommy-mor/a0fada6c7a20fd21693030338f9fcdf0 to your computer and use it in GitHub Desktop.
# Bhí Cathal anseo / Rinne Cathal é seo / Is é seo an cód is fearr
import random
def randburn():
return random.choice(["You've been a bad, bad boy ;)",
"You think you're so smart, don't you?"])
def find_num():
return random.randint(1,100)
def play_game():
print("I'm thinking of a number between 1 and 100")
correct = find_num()
guess = 0
while guess != correct:
guess = input("Guess my number: ")
try:
guess = int(guess)
if not(guess <= 100 and guess >= 1):
print(randburn())
elif guess < correct:
print("My number is higher")
elif guess > correct:
print("My number is lower")
except ValueError:
print(randburn())
print("Congrats, bud! You Win!")
play_game()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment