1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
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() |
buran write Oct-08-2024, 08:31 AM:
Spam link removed
Spam link removed