ropering / Study

0 stars 0 forks source link

[Python] key only #3

Open ropering opened 2 years ago

ropering commented 2 years ago
def key_only(dict):
    lst = []
    for k, v in dict.items():
        lst.append(k)
    return lst

ages = {
    'Emma' : 27,
    'Walter' : 26,
    'Watson' : 42,
}
key_only(ages) # ['Emma', 'Walter', 'Watson']