Guest User

Untitled

a guest
Nov 10th, 2018
4,034
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import random
  2.  
  3. def main():
  4.     player1 = 0
  5.     player1wins = 0
  6.     player2 = 0
  7.     player2wins = 0
  8.     rounds = 1
  9.  
  10.     while rounds != 10:
  11.         print("Round " + str(rounds))
  12.         player1 = dice_roll()
  13.         player2 = dice_roll()
  14.         print("Player 1 Roll: " + str(player1))
  15.         print("Player 2 Roll: " + str(player2))
  16.  
  17.         if player1 == player2:
  18.             print("Draw!\n")
  19.         elif player1 > player2:
  20.             player1wins = player1wins + 1
  21.             print("Player 1 wins!\n")
  22.         else:
  23.             player2wins = player2wins + 1
  24.             print("Player 2 wins!\n")
  25.  
  26.         rounds = rounds + 1
  27.    
  28.     if player1wins == player2wins:
  29.         print("Draw!")
  30.     elif player1wins > player2wins:
  31.         print("Player 1 Wins - Rounds Won: " + str(player1wins))
  32.     else:
  33.         print("Player 2 Wins - Rounds Won: " + str(player2wins))
  34.  
  35. def dice_roll():
  36.     diceRoll = random.randint(1, 6)
  37.     return diceRoll
  38.  
  39. main()
RAW Paste Data