I've asked the question a couple of times but I'm trying to reproduce a solution in Python from the book "Bayesian Statistics The Fun Way".
The question is: What is the probability of rolling three six-sided dices and getting a value of greater than 7?
The answer in the book says there are 218 possible outcomes, of which 181 are outcomes are greater than 7.
The code in R, which I've tried to reproduce in Python is:
count <- 0
for (roll1 in c(1:6){
for(roll2 in c(1:6){
for(roll3 in c(1:6){
count <-count + ifelse(roll1+roll2+roll3 > 7,1,0)
}
}
}
Tried this code where thankfully the community helped on getting an output from a function: https://stackoverflow.com/questions/72909169/confused-about-output-from-python-function
Then wanted to create a list of tuples to create set
But suspect I'm tying myself in circles, and am seeking a pointer rather than a solution. The results should be 216 permutations and 181 where result of sum is 181.