UNB/ CS/ David Bremner/ teaching/ cs2613/ tests/ T4/ sample/ samplesol/ table2dict.py
def table2dict(table):
    return { tup[0]: list(tup[1:]) for tup in zip(*table) }

def test_one_row():
    table=[["alice", "bob"],
           [27, 32]]
    assert table2dict(table)== { "bob": [32], "alice": [27] }

def test_two_rows():
    table2 = [["alice", "bob"],
              [1, 2],
              [False, True]]
    assert table2dict(table2)== { "bob": [2,True], "alice": [1,False] }