Advertisement
Guest User

Untitled

a guest
Nov 18th, 2019
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.47 KB | None | 0 0
  1. import random
  2. import os, sys
  3.  
  4. rejouer = True
  5. point = 0
  6. score_pc = 0
  7. while rejouer:
  8.  
  9.     chiffre = random.randrange(1, 4)
  10.  
  11.     print("""
  12.    \t 1 = pierre
  13.    \t 2 = feuille
  14.    \t 3 = ciseaux """)
  15.  
  16.     joueur = input("Entrer votre choix :")
  17.     joueur = int(joueur)
  18.  
  19.     if joueur == chiffre:
  20.         print("Vous etes à égaliter !!")
  21.  
  22.     elif joueur == 1 and chiffre == 2:
  23.         print("L'ordinateur a choisie la feuille. Vous avez perdu... ")
  24.         score_pc = score_pc + 1
  25.  
  26.     elif joueur == 1 and chiffre == 3:
  27.         print("L'ordinateur à choisier les ciseaux. Vous avez gagné !!!")
  28.         point = point + 1
  29.  
  30.     elif joueur == 2 and chiffre == 1:
  31.         print("L'ordinateur à choisie la pierre. Vous avez gagné !!")
  32.         point = point + 1
  33.  
  34.     elif joueur == 2 and chiffre == 3:
  35.         print("L'ordinateur à choisie les ciseaux. Vous avez perdu ...")
  36.         score_pc = score_pc + 1
  37.  
  38.     elif joueur == 3 and chiffre == 1:
  39.         print("L'ordinateur à choisie la pierre. Vous avez perdu ...")
  40.         score_pc = score_pc + 1
  41.  
  42.     elif joueur == 3 and chiffre == 2:
  43.         print("L'ordinateur à choisie la feuille. Vous avez gagné !!")
  44.         point = point + 1
  45.  
  46.     else:
  47.         print("je n'est pas compris ")
  48.  
  49.     print(f"Vous avez gagnée {point} contre {score_pc} pour l'ordinateur")
  50.  
  51.     question = input("Voulez vous rejouer ? (o/n) :")
  52.  
  53.     if question == "n":
  54.         rejouer = False
  55.  
  56. os.system("pause")
  57. sys.exit()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement