If you want to poll everyone's favorite Christmas activities, how will you store the responses?
You can store them in a list.
List items are ordered, changeable, and allow duplicate values, unlike sets.
List items are also indexed, the first item has index , the second item has index , etc.
$ list1 = ["apple", "banana", "cherry"] $ list2 = [1, 5, 7, 9, 3] $ list3 = [True, False, False] $ print(list1) "banana" $ print(list2) 1 $ print(list3) False $ print(list3) IndexError: list index out of range $ activities = ['snowball fight', 'sledding', 'skiing', 'caroling', 'sledding', 'caroling', 'sledding']
C. Try this:
Given a list of numbers, find and print all its elements with even indices (i.e. A, A, A, ...).
Given a list of numbers with all elements sorted in ascending order, determine and print the number of distinct elements in it.
Given a list of your friends' favorite Christmas activities (see above), iterate through the list to determine which activity is the most popular.