Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- my_dict = {
- "A":"K",
- "B":"D",
- "C":"A",
- "D":"Z",
- }
- b=[]
- #function declaration
- def common_elements(my_dict):
- for keys in my_dict:
- #check the dictionary values
- for items in my_dict[keys]:
- #if the values are foundin the keys append it to list b
- if items in my_dict:
- b.append(items)
- #print a sorted version of b
- print(sorted(b))
- common_elements(my_dict)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement