import random

# introduce the game
def instructions():
  print("############################################")
  print("Welcome to the number guessing game!")
  print("############################################")
  print("Press the ENTER key to continue")
  input()

# end the game
def ending()
  print("############################################")
  print("Thanks for playing the game!")
  print("############################################")

# get a guess and respond
def guess(correct):
  print("Enter your guess:")
  guess = int(input())
  if guess == correct:
    print("you are right!")
    return True;
  if guess < correct:
    print("you are low.")
    return False;
  if guess > correct:
    print("you are high.")
    return False;

# the main game loop
def game():
  number = random.randint(1, 100)
  result = False;
  while result == False:
    result = guess(number)

# run the game
instructions()
game()
ending()
Последнее изменение: пятница, 17 апреля 2026, 13:46