Files
nsi/Activity_3_python/exercises_3/exercise_3_5.py
T
2023-11-28 22:39:24 +01:00

16 lines
340 B
Python

import random
nombre = random.randint(1,100)
coup = 0
a = None
print("Le jeu consiste à deviner un nombre entre 1 et 100 :")
while a != nombre:
coup += 1
a = int(input("--> "))
if a < nombre:
print("trop petit !")
elif a > nombre:
print("trop grand !")
else:
print(f"Gagné en {coup} coups !")