Advertisement
kajs54

python project

Nov 18th, 2019
129
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.00 KB | None | 0 0
  1. import random
  2.  
  3. def main():
  4.     joueur1 = 0
  5.     player1wins = 0
  6.     joueur2 = 0
  7.     player2wins = 0
  8.     rounds = 1
  9.  
  10.     while rounds != 4:
  11.         print("Round numero: " + str(rounds))
  12.         joueur1 = dice_roll()
  13.         joueur2 = dice_roll()
  14.         print("Joueur 1 Rouleau: " + str(joueur1))
  15.         print("Joueur 2 Rouleau: " + str(joueur2))
  16.  
  17.         if joueur1 == joueur2:
  18.             print("Draw!\n")
  19.         elif joueur1 > joueur2:
  20.             player1wins = player1wins + 1
  21.             print("Joueur 1 gagne!!\n")
  22.         else:
  23.             player2wins = player2wins + 1
  24.             print("Joueur 2 gagne!!\n")
  25.  
  26.         rounds = rounds + 1
  27.    
  28.     if player1wins == player2wins:
  29.         print("Personne a gagné :( ")
  30.     elif player1wins > player2wins:
  31.         print("Joueur 1 a gagné - Rounds :  " + str(player1wins))
  32.     else:
  33.         print("Joueur 2 a gagné- Rounds : " + str(player2wins))
  34.  
  35. def dice_roll():
  36.     diceRoll = random.randint(1, 6)
  37.     return diceRoll
  38.  
  39. main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement