® |
G
x|
@
i
j
©
|
e,
)«
SO
v
| B
e
5
Sequences:
Lists
and
Tuples
>
NG~
5.26
(CARD
PLAYING:
DETERMINING
THE
WINNING
HAND)
Use
the
methods
developed
in
Exercise
5.25
to
write
a
script
that
deals
two
five-card
poker
hands
(i.e.,
two
lists
of
five
card
tuples
each),
evaluates
each
hand
and
determines which
wins.
As
3
each
card
is
dealt,
it
should
be
removed
from
the
list
of
tuples
representing
the
deck.
5.27
(INTRO
TO
DATA
SCIENCE:
DUPLICATE
ELIMINATION AND
COUNTING
FREQUENCIES)
Use
a
list
comprehension
to
create
a
list
of
50
random
values
in
the
range
1
through
10.
Use
NumPy's
unique
function
to
obtain
the
unique
values
and
their
frequencies.
Display
the
results.
5.28
(INTRO
TO
DATA
SCIENCE:
SURVEY
RESPONSE
STATISTICS)
Twenty
students
were
asked
to
rate
on
a
scale
of
1
to
5
the
quality
of
the
food
in
the
student
cafeteria,
with
1
being
"awful"
and
5
being
"excellent."
Place
the 20
responses
in
a
list
1,2,5,4,3,5,2,1,3,3,1,4,3,3,3,2,3,3,2,5
P
83
90
207
Determine
and
display
the
frequency
of
each
rating.
Use
the
built-in
functions,
statistics
module
functions
and
NumPy
functions
demonstrated
in
Section
5.17.210
to
display
the
following
response
statistics:
minimum,
maximum,
range,
mean,
median,
mode,
variance
and
standard
deviation.
5.29
(INTRO
TO
DATA
SCIENCE:
VISUALIZING SURVEY
RESPONSE
STATISTICS)
[
Using
the
list
in
Exercise
5.28
and
the
techniques
you learned
in
Section
5.17.215,
display
a
bar
chart
showing
the
response
frequencies
and
their
percentages
of
the
total
responses.
5.30
(INTRO
TO
DATA
SCIENCE:
REMOVING
THE
TEXT
ABOVE
THE
BARS)
Modify
the
die-rolling
simulation
in
Section
5.17.20
to
omit
displaying
the
frequencies
u
X
4
207
[
»