- 1

Need help solving this.

Can anyone solve this? With explanation. 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. 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.

29th Dec 2020, 8:45 PM
Ernie Magat
9 odpowiedzi
+ 7
This Is Am , please do *NOT* start a new question inside an existing feed. > it would be better if you start your own question, because the current discussion started years ago. hence people may not be aware of your question or issue.
17th Apr 2023, 10:28 AM
Lothar
Lothar - avatar
+ 6
Ernie Magat , sure - we can solve this. but this not what sololearn is made for. we are a learning platform, but we are not going to do your homework or your sololearn exercises. Before we will help you, please put your attempt in playground and link it here. if you have not done a try by yourself upto now, please do so. thanks for your understanding!
29th Dec 2020, 9:02 PM
Lothar
Lothar - avatar
+ 6
This Is Am , according your question: > what do you mean by saying *why this is not correct?* > by using a dice, i assume that you expect to get randomly different numbers. in this case we should not use random.seed(...) with same arguments. using the same argument value for seed will give the always the same result of output number. > if we omit the argument for seed() or if the argument is *None*, it uses the current system time. this could be used in your case.
17th Apr 2023, 10:34 AM
Lothar
Lothar - avatar
+ 2
Here you go. I struggled a lot to solve this problem. import random #import random module random.seed(int(input())) #please don't touch this lane # you dont need separate for loop because this # statement will work which accept an integer dice1 = random.randint(1,6) dice2 = random.randint(1,6) print(dice1) print(dice2)
17th Mar 2021, 8:53 PM
Somnath Das
Somnath Das - avatar
+ 1
import random random.seed(int(input())) #please don't touch this lane #generate the random values for every dice dice1 = random.randint(1,6) dice2 = random.randint(1,6) print(dice1) print(dice2)
17th May 2022, 7:35 AM
Najwan Najmussabah
+ 1
can anybody post hidden test case for understanding!!!!
17th Nov 2022, 3:10 PM
Sumit Deshmukh
Sumit Deshmukh - avatar
+ 1
it's okay, Tank U 👍
17th Apr 2023, 10:42 AM
AMINE MOUTAOUAKKIL
0
Thanks, Somnath !
28th Sep 2021, 5:10 PM
Archeo Profil
Archeo Profil - avatar
0
Why this not correct ? import random random.seed(int(input())) #please don't touch this lane #generate the random values for every dice for i in range(6): value1 = random.randint(1, 6) value2 = random.randint(1, 6) dice1 = value1 dice2 = value2 print(dice1) print(dice2)
16th Apr 2023, 4:04 PM
AMINE MOUTAOUAKKIL