Created
May 9, 2019 20:14
-
-
Save Coolfield/96411958e7dc2dea481e9ed8160a1a4c 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
import random as r | |
print("--------------------------------") | |
print(" Guess the Number") | |
print("--------------------------------") | |
print() | |
height = int(input("What is the max number of the desired range?")) | |
limit = int(input("Limit guesses? '0' if no.")) | |
num = r.randint(0, height) | |
count = 0 | |
guess = 0 | |
while guess != num: | |
guess_text = input("Guess a number between 0 and {0}: \n>".format(str(height))) | |
guess = int(guess_text) | |
if guess == 69: | |
print("Meal for two, a favourite of mine!!") | |
elif guess == 88: | |
print("Two fat ladies!") | |
elif guess == 3: | |
print("Cup of tea!") | |
elif guess == 4: | |
print("Knock at the door!") | |
elif guess == 5: | |
print("Man Alive!!!") | |
elif guess == 10: | |
print("Theresa's Den!") | |
elif guess == 27: | |
print("Duck and a crutch!") | |
elif guess == 32: | |
print("Buckle my shoe!") | |
elif guess == 46: | |
print("Up to tricks!") | |
elif guess == 52: | |
print("Chicken Vindaloo!") | |
elif guess == 57: | |
print("Heinz Varieties!") | |
elif guess == 80: | |
print("Gandhi's breakfast!") | |
elif guess == 85: | |
print("Staying Alive!") | |
if limit == 0: | |
continue | |
elif count == (limit - 1): | |
print("You failed to guess the number within the limit of guesses ({0})".format(limit)) | |
break | |
else: | |
count += 1 | |
if guess < num: | |
print("Your guess of {} was too low".format(guess_text)) | |
elif guess > num: | |
print("Your guess of {} was too high".format(guess_text)) | |
else: | |
print("You win! Your guess of {} was right!".format(guess_text)) | |
print("You guessed in ({0})".format(count)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment