Assignement (Dictionary)
Assignement (Dictionary)
Sample Dictionary :
dic1={1:10, 2:20}
dic2={3:30, 4:40}
dic3={5:50,6:60}
Expected Result : {1: 10, 2: 20, 3: 30, 4: 40, 5: 50, 6: 60}
10. Write a Python program to get the maximum and minimum values
of a dictionary.
16. 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
18. Write a Python program to extract a list of values from a given list
of dictionaries.
Original Dictionary:
[{'Math': 90, 'Science': 92}, {'Math': 89, 'Science': 94}, {'Math': 92,
'Science': 88}]
Extract a list of values from said list of dictionaries where subject =
Science
[92, 94, 88]
Original Dictionary:
[{'Math': 90, 'Science': 92}, {'Math': 89, 'Science': 94}, {'Math': 92,
'Science': 88}]
Extract a list of values from said list of dictionaries where subject =
Math
[90, 89, 92]