sorted returns a list that's sorted, but does
not modify it's argument. However, vals.sort()
does modify its argument, but returns None, i.e., doesn't
return a modified version of the list. Similarly,
vals.reverse() reverses the list to which its applied,
e.g., vals but returns None. However,
reversed(vals) returns a reversed version of its argument,
but doesn't alter its argument.
For the Highcard APT, consider this code:
mine.remove(dead) remvoves the value
dead from mine, but doesn't return
anything. Combine these ideas into code that solves the
APT. What are your ideas? Code?
a*b (a+1)*b = ab + b a*(b+1) = ab + a
long may be required, use what's
below where value is an int.
knowledge is a list of lists ,each one could be
displayed like the one above, how do you display all of them like
this (for New York Knicks), e.g., with extra spaces between
the chunks of underscores? Write code to do this.
_ _ _ _ _ _ _ _ _ _ _ _ _
secret is a string with spaces in it and
knowledge is a list of lists (of
underscores/letters) then as you loop over secret to find a
user's guessed letter you'll need to know which list of lists
you're in. Explain how looping over secret.split() is a
good idea ifyou keep track of the index of which list returned
by .split you're in, e.g., how the index of that .split() list can be
used to index knowledge to get the list in which an
underscore could be replaced.