Skip to content

Instantly share code, notes, and snippets.

@kazbom
Forked from GravenilvecTV/main.py
Created September 27, 2025 19:31
Show Gist options
  • Select an option

  • Save kazbom/b62de0f29d6100701bbc472ee1a3cf62 to your computer and use it in GitHub Desktop.

Select an option

Save kazbom/b62de0f29d6100701bbc472ee1a3cf62 to your computer and use it in GitHub Desktop.
APPRENDRE LE PYTHON #5 ? LES BOUCLES
# importation du randint
from random import randint
# choisir un nombre aleatoire entre 1 et 1000
just_price = randint(1, 1000)
# statut du jeu (activé/désactivé)
running = True
# tant que le jeu est en cours d'éxécution
while running:
# demander à l'utilisateur d'entrer un prix dans la console
user_price = int(input("Entrer un prix"))
# si le prix est le meme que le juste prix
if user_price == just_price:
print("Trouvé !")
# fin du jeu
running = False
# si le prix de l'utilisateur est supérieur au prix à trouver
elif user_price > just_price:
print("C'est moins")
# si le prix de l'utilisateur est inférieur au prix à trouver
elif user_price < just_price:
print("C'est plus")
# fin du jeu après la boucle
print("Fin du jeu !")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment