Question 1:
Write a Python program to print all distinct values in a dictionary.
Sample Data : li = [{“V”:“S001”}, {“V”: “S002”}, {“VI”: “S001”}, {“VI”: “S005”}, {“VII”:“S005”}, {“V”:“S009”},{“VIII”:“S007”}]
Expected Output: {‘S005’, ‘S002’, ‘S007’, ‘S001’, ‘S009’}
Question 2:
Write a Python program to find the highest 2 values in a dictionary.
my_dict = {‘a’:500, ‘b’:5874, ‘c’: 560,‘d’:400, ‘e’:5880}
Expected Output : 5880, 5874
Question 3:
Write a Python program to combine two dictionary by adding values for common keys.
d1 = {‘a’: 100, ‘b’: 200, ‘c’:300}
d2 = {‘a’: 300, ‘b’: 200, ‘d’:400}
Expected Output, d3 = {‘a’: 400, ‘b’: 400, ‘d’: 400, ‘c’: 300}
Question 4:
Write a Python program to rotate a 3X3 matrix anti-clockwise.
Sample matrix : [[1,4,7],[2,5,8],[3,6,9]]
Expected Output matrix : [[1, 2, 3],[4, 5, 6],[7, 8, 9]]