import random def roll_dice(): die1 = random.randint(1, 6) die2 = random.randint(1, 6) return die1, die2 def play_game(): score = 0 while True: # Roll the dice die1, die2 = roll_dice() print(f"You rolled: {die1} and {die2}") # Check for snake eyes if die1 == 1 and die2 == 1: print("Snake eyes! You lose.") score = 0 # No score if snake eyes are rolled break # Add the roll to the score score += (die1 + die2) print(f"Your current score is: {score}") # Ask if the user wants to roll again roll_again = input("Roll again? (y/n): ").lower() if roll_again != 'y': break # Show the final score print(f"Your final score is: {score}") # Start the game play_game()