Dice Roll Simulator in Python
This Snippet is coded by a user inOnline python Compiler. You can see and run this code too.
زبان: python
This Python program simulates rolling two six-sided dice. It uses the random module to generate random numbers between 1 and 6. After each roll, it asks the user whether they want to roll again. If the user types "yes" or "y", the dice are rolled again; otherwise, the program ends.
Key features:
- Rolls two dice at once.
- Simple loop structure with user-controlled continuation.
- Great for beginners learning
whileloops and therandommodule.
How to use:
- Run the script in any Python environment.
- Observe the two dice results printed on the screen.
- Type "y" or "yes" to roll again, or any other input to exit.