Last active
May 7, 2019 09:23
-
-
Save Emalios/2c8ee279311f8f6f6998e5ea97a5c92c to your computer and use it in GitHub Desktop.
Petit Juste Prix
This file contains 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
from math import * | |
from random import * | |
players=[] | |
tant=True | |
end="end" | |
while tant: | |
print("Quand vous avez entré le nom de tous les joueurs il faut marquer", end) | |
msg=input("Entrez le nom d'un joueur :") | |
if msg==end: | |
tant=False | |
else: | |
players.append(msg) | |
nbPlayers=int(len(players)) | |
min=0 | |
max=2500 | |
prix=int(randint(min, max)) | |
print("Vous allez donc jouer avec", nbPlayers, "joueur(s)" ) | |
tant=True | |
while tant: | |
i = nbPlayers | |
while i!=0 and tant: | |
print(players[i-1], ":") | |
print("Prix compris entre :", min, "et :", max) | |
rep=int(input("Entrez un nombre :")) | |
if rep == prix: | |
print("Félicitations, vous avez gagné !") | |
tant=False | |
elif rep > prix: | |
print("Nombre trop grand") | |
max=rep | |
elif rep < prix: | |
print("Nombre trop petit") | |
min=rep | |
i-=1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment