-
-
Save tommy-mor/a0fada6c7a20fd21693030338f9fcdf0 to your computer and use it in GitHub Desktop.
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
# 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