Write a python function that takes a dictionary and a string, appends the string to the list of values


Topic: Write a python function that takes a dictionary and a string, appends the string to the list of values

Solution

def addnames_in_dict (dictname, name):
    for i in dictname:
        dictname[i].append(name)
    return dictname
addnames_in_dict({"1":["A"]}, "Arun")



List all Python Programs