import random def roll_dice(): """Rolls two six-sided dice and returns the sum.""" die1 = random.randint(1, 6) die2 = random.randint(1, 6) return die1 + die2 def main(): while True: roll = input("Would you like to roll the dice? (yes/no): ") if roll.lower() == "no": break sum = roll_dice() print("You rolled:", sum) if __name__ == "__main__": main()Can I add features like keeping track of the user's score or allowing them to choose the number of dice to roll?
buran write Oct-08-2024, 08:31 AM:
Spam link removed
Spam link removed