Dice Rolling stimulator

Here’s a description for a Dice Rolling Simulator exercise: Description: Create a program that simulates rolling a dice. The program should generate a random number between 1 and 6, representing the outcome of rolling a standard six-sided dice. After displaying the result, the user should be prompted to roll again or exit the simulation. Steps: Use Python’s random module to generate a random number between 1 and 6. After displaying the result, ask the user if they want to roll again. If the user chooses to roll again, repeat the process. If not, terminate the program.

Solutions

Solution: 1

import random

dice =["""
[-----------]
[           ]
[     0     ]
[           ]
[-----------]""",
"""
[-----------]
[  0        ]
[           ]
[        0  ]
[-----------]""",
"""
[-----------]
[  0        ]
[     0     ]
[        0  ]
[-----------]""",
"""
[-----------]
[  0     0  ]
[           ]
[  0     0  ]
[-----------]""",
"""
[-----------]
[  0     0  ]
[     0     ]
[  0     0  ]
[-----------]""",
"""
[-----------]
[  0     0  ]
[  0     0  ]
[  0     0  ]
[-----------]"""]

y = input("press y if you want to roll the dice")

while(y=='y'):
    face = random.randint(1,6)
    print(dice[face-1])
    y = input("press y if you want to roll the dice again")