subject

There are 36 possible combinations of two dice.
A simple pair of loops over range(6)+1 will enumerate all combinations.
The sum of the two dice is more interesting than the actual combination.
Create a dict of all combinations, using the sum of the two dice as the key.

Each value in the dict should be a list of tuples; each tuple has the value of two dice.
The general outline is something like the following:

d= {}
Loop with d1 from 1 to 6
Loop with d2 from 1 to 6
newTuple ← ( d1, d2 ) # create the tuple
oldList ← dictionary entry for sum d1+d2
newList ← oldList + newTuple
replace entry in dictionary with newList

Loop over all values in the dictionary
print the key and the length of the list

ansver
Answers: 2

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 05:10
Read the code below. what will the computer print if the input for year_variable is 1700? if year_variable == 1776: print("your answer is correct. the declaration of independence was signed in “year_variable”.") elif year_variable < 1776: compute_variable = 1776 - year_variable. print("add “compute_variable“ years to your answer for the correct answer.") elif year_variable > 1776: compute_variable = year_variable - 1776 print("subtract “compute_variable” years from your answer for the correct answer.")
Answers: 1
question
Computers and Technology, 22.06.2019 20:00
Awide variety of “ apps “ are available to customize devices. which category of app does the word processing software fall into?
Answers: 2
question
Computers and Technology, 23.06.2019 08:00
The managing director of a company sends a christmas greeting to all his employees through the company email. which type of network does he use? he uses an .
Answers: 3
question
Computers and Technology, 24.06.2019 10:10
Scanning the road can be thought of as a
Answers: 2
You know the right answer?
There are 36 possible combinations of two dice.
A simple pair of loops over range(6)+1 will e...
Questions
question
History, 12.03.2021 18:20
question
Mathematics, 12.03.2021 18:20
question
Mathematics, 12.03.2021 18:20
Questions on the website: 13722360