Trying to solve No dice? No problem in python core | Sololearn: Learn to code for FREE!

0

Trying to solve No dice? No problem in python core

Don't what is wring with my code import random random.seed(int(input())) #please don't touch this lane for i in ramge(n): #generate the random values for every dice dice1 = random.randint(1,6) dice2 = random.randint(1,6) print(dice1) print(dice2)

4/6/2021 12:20:49 PM

Simisola Osinowo

8 Answers

New Answer

-1

why are you using the loop? are the loops already given in the code? Well, I don't know the use of random.seed() This might work: import random random.seed(int(input())) #please don't touch this lane dice1 = random.randint(1,6) dice2 = random.randint(1,6) print(dice1) print(dice2)

+1

I hope this solves your problem import random #please don't touch this lane n=int(input()) for i in range(n): #generate the random values for every dice dice1=random.randint(1,6) dice2=random.randint(1,6) print(dice1) print(dice2) Just give a no for range of input. Like n=5 Or try this import random #please don't touch this lane n=randim.randint(1,100) for i in range(n): #generate the random values for every dice dice1=random.randint(1,6) dice2=random.randint(1,6) print(dice1) print(dice2)

+1

Thanks It worked

0

Both did not work

0

Can you give me the question along with the sample input and output?

0

Two friends want to play backgammon, but have lost the dice. Create a program to replace the dice. When the program is run, it should roll the dice and output the result of each die. Hint Use random.randint() function to generate random values in the range of 1 to 6 for each dice.

0

You will see a random.seed(int(input())) line in sample code. It initializes the pseudorandom number generator and, in this case, ensures functionality of test cases.

0

But it did not work