Write a function
clamp_2d_list(a_2d_list, minimum_value,
maximum_value)
,
which takes 3 parameters. The first parameter is a
2-dimensional list
(not necessarily square) of integers, and the final two
parameters are
also integers. Your function should return a 2
dimensional list of the
same dimensions of a_2d_list, where each value in
the 2-d list
has been clamped between the specified minimum and maximum
values.
>>> my_list = [[-2, -1], [0, 1]] >>> print(clamp_2d_list(my_list, -1, 0)) [[-1, -1], [0, 0]]
Write a function called remove_dups(a_list)
, which
takes a two
dimensional list of items as a parameter. This function
should return a new
list, which contains all of the unique items from the input
list.
>>> in_list = [0, 1, 2, 1, 2, 3] >>> print(remove_dups(a_list)) [0, 1, 2, 3]
Write a function called generate_vigenere()
, which
takes 0
parameters. Your function should return a dictionary that
represents a
Vigenère square. Your function should generate this
dictionary
dynamically, as opposed to hard-coding the values. For
example:
>>> square = generate_vigenere() >>> for key in square: ... print(key, "->", square[key]) 'a' -> ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z'] 'c' -> ['c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', 'a', 'b'] 'b' -> ['b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', 'a'] 'e' -> ['e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', 'a', 'b', 'c', 'd'] 'd' -> ['d', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', 'a', 'b', 'c'] . . .