Created
September 12, 2019 22:43
-
-
Save tusharvikky/0d6bbec6483e6fe6e9e77f1b15ec3292 to your computer and use it in GitHub Desktop.
This file contains 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 | |
games_total = 0 | |
while games_total <= 0: | |
print(f'How many games would you like to play?') | |
games_total = int(input()) | |
for x in range(games_total): | |
current = 0 | |
number = random.randint(1, 25) | |
guesses_count = 1 | |
while current != number: | |
print(f'\nGame number: {x+1}') | |
print(f'Choose a number between 1 and 25') | |
current = int(input()) | |
if current > number: | |
print(f'Your guess is higher than my number') | |
elif current < number: | |
print(f'Your guess is lower than my number') | |
else: | |
if guesses_count > 1: | |
trys = 'tries' | |
else: | |
trys = 'try' | |
print(f'You guessed my number with only {guesses_count} {trys}. Congratulations!') | |
guesses_count += 1 | |
print(f'Game Over!') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment