Q17Multiple correct3 Marks1 Sep 2024
Consider the below snippets which are intended to create a dictionary with the elements as key and their frequency in the given list as values. Choose all the correct options regarding the given code.
Snippet-1
L = ['yellow', 'indigo', 'blue', 'yellow', 'blue']
freq = {word: L.count(word) for word in L}
print(freq)
Snippet-2
L = ['yellow', 'indigo', 'blue', 'yellow', 'blue']
freq = {word: count(word) for word in L}
print(freq)