Question
Python Coding This is the coding I currently have but i need to make it to where it calculates and shows the probability and percentage
Python Coding
This is the coding I currently have but i need to make it to where it calculates and shows the probability and percentage chance as well.
My Code:
print("B Level Assignment") print(' ') def combinations():
dict={2:[],3:[],4:[],5:[],6:[],7:[],8:[],9:[],10:[],11:[],12:[]} for first_dice in range(1,7): for second_dice in range(1,7): sum =first_dice+second_dice combination=str(first_dice)+"+"+str(second_dice) value=dict.get(sum) value.append(combination)
print("{0:^10}{1:^34}".format("Total on dice","Combinations")," ") for key,value in dict.items(): build_string="" for item in value: build_string+=item+"," build_string=build_string[:-1] print("{0:
#print(dict) combinations()
Level B: Create another table that generates the probability of getting a specific sum when two dice are rolled Total on dice Combinations Probability Percentage chance 1/36 2/36 3/36 4/36 5/36 6/36 5/36 4/36 3/36 2/36 1/36 3% 6% 8% 11% 14% 17% 14% 11% 5% 5% 3% 2 1+2, 2+1 1+3, 2+2, 3+1 1+4, 2+3, 3+2, 4+1 1+5, 2+4, 3+3, 4+2, 5+1 1+6, 2+5, 3+4, 4+3, 5+2, 6+1 2+6, 3+5, 4+4, 5+3, 6+2 3+6, 4+5, 5+4, 6+3 4+6, 5+5, 6+4 5+6, 6+5 6+6 4 7 10 12Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started