replit / ReplitLM

Inference code and configs for the ReplitLM model family
https://huggingface.co/replit
Apache License 2.0
918 stars 75 forks source link

Guess #55

Open Nelson19so opened 2 months ago

Nelson19so commented 2 months ago

import random

def display_menu(): print("Welcome to Guessing Game Puzzle") print("1. Select Level") print("2. Exit")

def game_level(): print("Choose your game level") print("3. Easy") print("4. Hard")

def play_game(chances): number = random.randint(1, 100) print("Guess the number: ") while chances > 0: guess_number = int(input()) if guess_number < number: print("Number too low") elif guess_number > number: print("Number too high") elif guess_number == number: print("You win!") break print("Number of chances left: ", chances) chances -= 1 if chances == 0: print("You lose!")

def main(): display_menu() choice = int(input("Enter your preference: ")) if choice == 1: game_level() level = int(input("Enter your preferred level: ")) if level == 3: play_game(10) elif level == 4: play_game(5) else: print("Wrong input") elif choice == 2: print('Exiting game') else: print("Try again")

if name == "main": main()

Nelson19so commented 1 month ago

Nice