Advertisement
Guest User

Untitled

a guest
Jan 17th, 2020
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.67 KB | None | 0 0
  1. #Exercice dictionnaire 3
  2. #Lucas Delvoye
  3.  
  4. import random
  5.  
  6. resultat = random.randint (1, 1000)
  7. b = 0
  8. tempmin = 1
  9. tempmax = 1000
  10. nbr_essais = 0
  11.  
  12. while b != resultat:
  13. print ("***Le résultat est entre", tempmin, "et", tempmax, "***")
  14. b = int(input())
  15. print ("Le résultat est-il", b, "?")
  16. if b < resultat:
  17. print (" -Non il est plus grand")
  18. tempmin = b
  19. elif b > resultat:
  20. print (" -Non il est plus petit")
  21. tempmax = b
  22. else:
  23. print ("Oui\nPOGGERS!")
  24. print ("Seulement", nbr_essais, "essais!")
  25. print ("***------------------------------------------------------------***")
  26. nbr_essais += 1
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement