Listing 08-22: Guessing the number

##############################################################################
# Python From Scratch
# Autor: Nilo Ney Coutinho Menezes
# Editora Novatec (c) 2010-2024
# Site: https://pythonfromscratch.com
#
# File: listing\chapter 08\08.22 - Guessing the number.py
# Description: Guessing the number
##############################################################################

import random
n = random.randint(1, 10)
x = int(input("Choose a number between 1 and 10:"))
if x == n:
    print("You got it right!")
else:
    print("You made a mistake.")
Click here to download the file