Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Игра позволяет пользователю загадать число от 1 до 100 и компьютер его угадывает
- # В конце выводится загаданное число и количество затраченных компьютером попыток
- import random
- print("\tWelcome to the game 'Guess The Number'")
- print("You think the number and the computer tries to guess this number.\n")
- number = ""
- while number not in range(1, 100):
- number = int(input("Enter the number in the range between 1 to 100: "))
- numbers_list = []
- tries = 0
- while random.randrange(1, 100) != number:
- tries += 1
- else:
- print("Your number is", number, ". Total tries is", tries)
Advertisement
Add Comment
Please, Sign In to add comment