Q. Write a random number generator that generates random numbers between 1 and 6 (simulates a dice).
Answer :-
import random min = 1 max = 6 roll_again = "y" while roll_again == "y" or roll_again == "Y": print("Rolling the dice...") val = random.randint (min, max) print("You get... :", val) roll_again = input("Roll the dice again? (y/n)...")
Output :-
Rolling the dice...
You get... : 3
Roll the dice again? (y/n)...y
Rolling the dice...
You get... : 1
Roll the dice again? (y/n)...n
>>>
Thankyou sir
ReplyDeleteWelcome : )
Deletegood job
ReplyDeleteThankyou : )
DeleteThank you
ReplyDeleteThis is needed to me to show to maam on tomorrow...🎓
All the best 👍
DeleteThe last part is wrong.It will not stop iterating unless break is written in a correct manner
ReplyDeletePlease run this code in your pc.
DeleteThanks
ReplyDeleteThanks
ReplyDeletethanks sir
ReplyDeletePost a Comment
You can help us by Clicking on ads. ^_^
Please do not send spam comment : )