Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import logo
- import random
- print(logo.logo)
- RANDOM_NUMBER = random.randint(1, 100)
- print(RANDOM_NUMBER)
- USER_DIFF = int(input("Type '1' for easy, or '2' for hard. "))
- print(USER_DIFF)
- def game(randnum, usrdif):
- player_lives = 10
- if usrdif == 2:
- player_lives = 5
- is_playing = True
- while is_playing == True:
- user_guess = int(input("Guess a number between 1 - 100 "))
- if user_guess == randnum:
- print(f"Congrats, You correctly guessed {randnum} with {player_lives} lives left!")
- is_playing = False
- else:
- player_lives -= 1
- if player_lives == 0:
- print(f"Sorry, You ran out of lives, better luck next time! The number I was thinking of was {randnum}")
- is_playing = False
- if user_guess > randnum:
- print(f"Sorry, {user_guess} was too high, try lower next time. {player_lives} lives remaining")
- if user_guess < randnum:
- print(f"Sorry {user_guess} was too low, try higher next time. {player_lives} lives remaining")
- game(RANDOM_NUMBER, USER_DIFF)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement