As usual, create a directory to hold today's files. All programs that you write today should be stored in this directory.
$ cd ~/cs120/labs $ mkdir lab33 $ cd lab33
Write a function called magic_col(a_2d_list)
, which takes as a
parameter a two dimensional list of integers. This function should return
\(True\) if all of the columns sum to the same value. It should return
\(False\) in all other cases.
Write a function called remove_dups(a_list)
, which takes a one
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.
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'] . . .