Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import random
- start =input("Press enter to begin")
- player = random.randint(1, 6)
- comp = random.randint(1, 6)
- print("Round 1:")
- print("Player:", player)
- print("Computer:", comp)
- start2 = input("Press enter to play again")
- player2 = random.randint(1, 6)
- comp2 = random.randint(1, 6)
- print("Round 2")
- print("Player:", player2)
- print("Computer:", comp2)
- total_player1 = player + player2
- total_comp1 = comp + comp2
- print("Player total:", total_player1)
- print("Computer total:", total_comp1)
- if total_comp1 >= 10 or total_player1 >= 10:
- if total_player1 > total_comp1:
- print("You won")
- elif total_comp1 > total_player1:
- print("The computer won")
- elif total_comp1 == total_player1:
- print("The game is a draw")
- else:
- start3 = input("Press enter to play again")
- player3 = random.randint(1, 6)
- comp3 = random.randint(1, 6)
- print("Round 3")
- print("Player:", player3)
- print("Computer:", comp3)
- total_player2 = player + player2 + player3
- total_comp2 = comp + comp2 + comp3
- print("Player total:", total_player2)
- print("Computer total:", total_comp2)
- if total_comp2 >= 10 or total_player2 >= 10:
- if total_player2 > total_comp2:
- print("You won")
- elif total_comp2 > total_player2:
- print("The computer won")
- elif total_comp2 == total_player2:
- print("The game is a draw")
- else:
- print("None of the players reach 10, please play again")
Advertisement
Add Comment
Please, Sign In to add comment