0
Can you please solve this?
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. 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. https://code.sololearn.com/cUw82b53YXS5/?ref=app
6 Respostas
+ 3
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)
+ 1
import random
random.seed(int(input()))
dice1 = random.randint(1, 6)
dice2 = random.randint(1, 6)
print(dice1)
print(dice2)
try this code
0
If you have no idea I suggest you reviewing the lesson
https://www.sololearn.com/learn/JUMP_LINK__&&__Python__&&__JUMP_LINK/2438/
0
Use random randint to generate a random number:
random.randint(1, 6)
0
what is random. seed
0
import random
random.seed(int(input()))
dice1 = random.randint(1, 6)
dice2 = random.randint(1, 6)
print(dice1)
print(dice2)