Advertisement
Carotte

papuier 1

Nov 6th, 2020
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.33 KB | None | 0 0
  1. 12&é# jeu pierre, papier, ciseaux
  2. # l'ordinateur joue au hasard
  3.  
  4. from random import randint
  5.  
  6. def ecrire(nombre):
  7. if nombre == 1:
  8. print("pierre",end=" ")
  9. elif nombre ==2:
  10. print("papier",end=" ")
  11. else :
  12. print("ciseaux",end=" ")
  13.  
  14. def scores(mon_coup,ton_coup):
  15. global mon_score, ton_score
  16. if mon_coup == 1 and ton_coup == 2:
  17. ton_score += 1
  18. elif mon_coup == 2 and ton_coup == 1:
  19. mon_score += 1
  20. elif mon_coup == 1 and ton_coup == 3:
  21. mon_score += 1
  22. elif mon_coup == 3 and ton_coup == 1:
  23. ton_score += 1
  24. elif mon_coup == 3 and ton_coup == 2:
  25. mon_score += 1
  26. elif mon_coup == 2 and ton_coup == 3:
  27. ton_score += 1
  28.  
  29. ton_score = 0
  30. mon_score = 0
  31. print("Pierre-papier-ciseaux. Le premier à 10 a gagné !")
  32. no_manche = 0
  33. while mon_score < 10 and ton_score < 10:
  34. ton_coup = int(input("1 : pierre, 2 : papier, 3 : ciseaux ? "))
  35. while ton_coup < 1 or ton_coup > 3:
  36. ton_coup = int(input("1 : pierre, 2 : papier, 3 : ciseaux ? "))
  37. print("Vous montrez",end=" ")
  38. ecrire(ton_coup)
  39. mon_coup = randint(1,3)
  40. print("- Je montre",end=" ")
  41. ecrire(mon_coup)
  42. print() # aller à la ligne
  43. scores(mon_coup,ton_coup)
  44. print("vous",ton_score," moi",mon_score)
  45.  
  46.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement