| 12
 3
 4
 5
 6
 7
 8
 9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 
 | from random import randrange
import os
Boucle = True
 
def VerifieNombre(Chiffre, ChiffreAleatoire):
    if Chiffre == ChiffreAleatoire:
        print("C'est le bon chiffre, bravo ! ")
        Possible = True
    elif Chiffre > ChiffreAleatoire:
        print("C'est moins !")
        Possible = False
    elif Chiffre < ChiffreAleatoire:
        print("C'est plus !")
        Possible = False
        return Possible
 
def ProduitAleatoire():
    ChiffreAleatoire = randrange(1, 50)
    return ChiffreAleatoire
 
def Continuer():
    print("Voulez vous rejouer (o/n) ?")
    Reponse = input()
    if Reponse.upper() == "O":
        Boucle = True
    elif Reponse.upper() == "N":
        Boucle = False
        return Boucle
 
ChiffreAleatoire = ProduitAleatoire()
print("Entrez un chiffre entre 1 et 50")
while Boucle == True :
    Chiffre = int(input())
    Possible = VerifieNombre(Chiffre, ChiffreAleatoire)
    if Possible == True:
         Boucle = Continuer()
 
 
 
 
os.systeme("Pause") | 
Partager