The program displays random numbers on the screen and requests for the spelling of that number. It checks if the input is correct, then it displays another number. If the input is wrong, then it will send an error message and request another answer with 3 attempts.
from random import randint
atempt = 3
while atempt > 0:
n = str(randint(10,999))
print(f"number: {n}")
user_n = input("write that number: ")
if n != user_n:
print("wrong, try again")
else:
print("right !")
atempt = 0
atempt -= 1
Comments
Leave a comment