Answer to Question #228840 in Python for Jayanth

Question #228840
Dictionary company started an app which does not store the words initially,and once a word comes it stores and shows the repeated one.need to write a function which returns the words that are repeated.if no words are present return"na" ,if present,return repeated woŕds in alphabetical order
1
Expert's answer
2021-08-25T07:07:15-0400
test_list = [{'gfg' : 2, 'is' : 4, 'best' : 6}, 
             {'it' : 5, 'is' : 7, 'best' : 8},
             {'CS' : 10}]
  
# Printing original list
print("The original list is : " + str(test_list))
  
# Using loop
# Find dictionary matching value in list
res = None
for sub in test_list:
    if sub['is'] == 7:
        res = sub
        break
  
# printing result 
print("The filtered dictionary value is : " + str(res))

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS