Name____________________ net-id _________ Name____________________ net-id _________ Name____________________ net-id _________ Name____________________ net-id _________
toss
, where toss has five-values 1-6 representing die
rolls. For purposes of this exposition assume
toss=[3,2,5,3,5]
-- the first step is to count the number
of occurrences of each possible die-roll.
counts
?
counts = [toss.count(i) for i in toss]
counts = [toss.count(i) for i in range(1,7)]
counts = [toss[i] for i in range(1,7)]
toss
as shown:
return max([i*toss.count(i) for i in range(1,7)])
return max([toss[i]*toss.count(i) for i in range(1,7)])
return max([i*toss[i] for i in range(1,7)])
return max([i*toss.count(i) for i in toss])
scores
is a list of int values all between 0 and 100,
inclusive.
Which of the following correctly sets mode
to be the number
of times the most frequently occurring value occurs. Note: not
the modal value, but it's number of occurrences. There
could be more than one correct answer.
mode = max([scores.count(i) for i in scores])
mode = max([scores.count(i) for i in range(0,101)])
mode = max([val for val in scores])
answer
and guess
and their respective values assigned before the
loops
in the functions play_game_computerguess
and
play_game_humanguess
, respectively?
'none'
and
-1
ensure the loops will be entered.
'none'
and -1
that are used.
raw_input
.
play_game_humanguess
there's no code
to process the return value "correct"
returned by
get_status
. Which is the best explanation for why
no code is needed to process this return value?
elif
or else
to handle a
case Python will automatically generate code to handle it.
secret != guess
handles the case of a
correct
guess and it's the code executed after the elif
.
"correct"
this means that the number of guesses reported is wrong after the loop finishes.