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

Other questions on the subject: Computers and Technology

image
Computers and Technology, 23.06.2019 10:50, whyidkmyself
Your friend kayla is starting her own business and asks you whether she should set it up as a p2p network or as a client-server network. list three questions you might ask to kayla decide which network to use and how her answers to those questions would affect your recommendation.
Answers: 2
image
Computers and Technology, 23.06.2019 11:30, leapfroggiez
Auser is given read permission to a file stored on an ntfs-formatted volume. the file is then copied to a folder on the same ntfs-formatted volume where the user has been given full control permission for that folder. when the user logs on to the computer holding the file and accesses its new location via a drive letter, what is the user's effective permission to the file? a. read b. full control c. no access d. modify e. none of the above
Answers: 1
image
Computers and Technology, 23.06.2019 21:20, FlowerChild1229
For positive constants a and b, the force between two atoms in a molecule is given f(r) = −a r2 + b r3 , where r > 0 is the distance between the atoms. note: a and b are upper case letters. (a) find f '(r) = (b) find the critical point for f(r). r = (c) find f ''(r) = (d) find the value of r so that f ''(r) = 0.
Answers: 1
image
Computers and Technology, 25.06.2019 01:00, 59279
Why is outfitting a workplace with video games in a technology development company consiered a strategic use of money
Answers: 1
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 in other subjects:

Konu
Arts, 03.07.2019 06:00