Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/muhammadalamzeb/python_projects/llms.txt

Use this file to discover all available pages before exploring further.

This script simulates rolling a pair of six-sided dice. Each roll produces two independent random numbers between 1 and 6, printed together as a tuple. You control the pace — roll as many times as you like, then quit when you’re done.

How to run

python3 Dice_Game.py

Gameplay

At each prompt, the game asks Roll the dice? Y/N:.
InputWhat happens
YRolls both dice and prints the result
NExits the program
Anything elsePrints "Invalid input. Please enter Y or N." and prompts again
Each roll generates two independent values using random.randint(1, 6), so every number from 1 to 6 is equally likely for each die.
Input is case-insensitive. The script calls .lower() on your input, so y, Y, n, and N are all accepted.

Terminal session example

Roll the dice? Y/N: y
(3, 5)You rolled a
Roll the dice? Y/N: y
(1, 1)You rolled a
Roll the dice? Y/N: y
(6, 2)You rolled a
Roll the dice? Y/N: maybe
Invalid input. Please enter Y or N.
Roll the dice? Y/N: n

Build docs developers (and LLMs) love