Question: I need help with doing this program using python 3 Let the user specify S (the number of sides on a die) and N (the
I need help with doing this program using python 3
Let the user specify
S
(the number of sides on a die) and
N
(the number of tosses of two
S
-sided dice).
Assume
((S << N)
and
(3 <= S <= 20))
. Since each die side is labeled with a unique integer taken
from the range
[ 1,S ]
, the sum of each dice toss is in the range
[ (2=1+1),(2*S=S+S) ]
. For
example, when
S = 6
, then the sum of each dice toss is in the range
[ 2,12 ]
. Make
N
dice tosses and
count how frequently each sum occurs. Output a
horizontal histogram
that depicts the frequency distribution
of the sums of the
N
dice tosses. Every sum in the range
[ 2,2*S ]
and its frequency of occurrence should be
output using the format
XXX (XXXXXXXX) | ******
where
XXX
is the sum,
(XXXXXXXX)
is the frequency, and each
'*'
represents
1%
of the
100%
of frequency
distribution. The number of
'*'
output for each sum is computed by rounding the quotient
(counts[sum]/N)
up to the nearest integer. The entire histogram will contain
(2*S-2+1)
lines
2 (XXXXXXXX) | ******
3 (XXXXXXXX) | ******
. . .
. . .
2*S (XXXXXXXX) | ******
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
