Skip to content

Instantly share code, notes, and snippets.

@amankharwal
Created Jan 16, 2021
Embed
What would you like to do?
#importing module for random number generation
import random
#range of the values of a dice
min_val = 1
max_val = 6
#to loop the rolling through user input
roll_again = "yes"
#loop
while roll_again == "yes" or roll_again == "y":
print("Rolling The Dices...")
print("The Values are :")
#generating and printing 1st random integer from 1 to 6
print(random.randint(min_val, max_val))
#generating and printing 2nd random integer from 1 to 6
print(random.randint(min_val, max_val))
#asking user to roll the dice again. Any input other than yes or y will terminate the loop
roll_again = input("Roll the Dices Again?")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment