justeprix.py

Created by stimorol

Created on November 16, 2023

494 Bytes

L’utilisateur doit trouver un nombre entre 0 et 1000. A chaque tentative, l’utilisateur est averti si le nombre entré est plus grand ou plus petit que le nombre a trouver. Il est conseillé d’utiliser la petite police de python pour utiliser ce script.


from random import *
num,user=randint(0,1000),int(input(">>> Bienvenue dans le juste prix !\nPour jouer, écrivez votre nombre et nous\nvous dirons si le nombre a trouver est\nplus petit ou plus grand que votre nombre.\n  ----  BONNE CHANCE ! ----\n"))
while 1: user=int(input(("-"*42+"\nFélicitations ! Vous avez gagné !\nLe résultat a trouver était "+str(num)) if user==num else ("Le bon résultat est supérieur: " if user<num else "Le bon résultat est inférieur: ")))

During your visit to our site, NumWorks needs to install "cookies" or use other technologies to collect data about you in order to:

With the exception of Cookies essential to the operation of the site, NumWorks leaves you the choice: you can accept Cookies for audience measurement by clicking on the "Accept and continue" button, or refuse these Cookies by clicking on the "Continue without accepting" button or by continuing your browsing. You can update your choice at any time by clicking on the link "Manage my cookies" at the bottom of the page. For more information, please consult our cookies policy.