Last active
December 9, 2025 22:30
-
-
Save GravenilvecTV/956718c478c7880b68fc21e723eb9bda to your computer and use it in GitHub Desktop.
APPRENDRE LE PYTHON #5 ? LES BOUCLES
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # 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 !") |
CODERdu92
commented
Dec 9, 2025
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment