Dictionaries and sets
Look values up by key, and keep only unique items.
A dictionary maps keys to values. Lookups are fast however large it gets.
Expected output
Ravi not given name = Ravi dept = CSE year = 3
Counting with a dictionary
This pattern appears in a lot of coding tests.
Expected output
{'b': 1, 'a': 3, 'n': 2}Sets
A set keeps unique items and has no order, so sort it before printing.
Expected output
[2, 3] [1, 2, 3, 4] 3