7.dict Assignment
7.dict Assignment
dic1={1:10, 2:20}
dic2={3:30, 4:40}
dic3={5:50,6:60}
Sample Dictionary ( n = 5) :
Sample Dictionary
{1: 1, 2: 4, 3: 9, 4: 16, 5: 25, 6: 36, 7: 49, 8: 64, 9: 81, 10: 100, 11: 121, 12: 144,
13: 169, 14: 196, 15: 225}
15. Write a Python program to combine two dictionary adding values for
common keys.
Sample output: Counter({'a': 400, 'b': 400, 'd': 400, 'c': 300})
17. Write a Python program to get the top three items in a shop.
Sample data: {'item1': 45.50, 'item2':35, 'item3': 41.30, 'item4':55, 'item5': 24}
Expected Output:
item4 55
item1 45.5
item3 41.3