Ask coding questions

← Back to all posts
today's question
KrisLee4

hey guys, I am right now doing another question. here it is:

Two dice are rolled, find the probability that the sum is
a) equal to 1
b) equal to 4

and my progress is this:

import random

rollDice = random.randint(1, 6)
rollDice2 = random.randint(1, 6)
print(rollDice+rollDice2)

what should i edit and do next?

Voters
KrisLee4
Comments
hotnewtop
SixBeeps

For this, you won't want to use any random values.
The question is asking for the definite probability of each roll, so you instead need to solve it iteratively. Have you gone over for loops yet?