lst = [ "a", "b", "c" ]

for w in lst:
    print(w, "!")
    
###
    
d = { "ABC" : 42, "DEF" : 7, "GHI" : -21 }

for k in d:
    print("Key:", k)
    print("Value:", d[k])

###
    
total = 0
for k in d:
    total = total + d[k]
print(total)

###


def makeAlphaDict(words):
    d = { }
    for w in words:
        # add w to the dictionary
        first = w[0]
        if first in d:
            d[first].append(w)
        else:
            d[first] = [ w ]
    return d

sentence = "CMU Tartans Go Team Go"
words = sentence.split(" ")
print(words)
print(makeAlphaDict(words))
###

def createMultDict(n):
    outerD = { }
    for x in range(1, n+1):
        innerD = { }
        for y in range(1, n+1):
            result = x * y
            innerD[y] = result
        outerD[x] = innerD
    return outerD

print(createMultDict(4))

###

def hasShortKeys(d, limit):
    for k in d:
        if len(k) > limit:
            return False
    return True
    
print(hasShortKeys({ "abc" : 2, "de" : 5}, 3))
print(hasShortKeys({ "abc" : 2, "defgh" : 2}, 4))