Question: Use python to solve this question please! Part 2: Dictionaries (1 point) Dictionaries are like lists in the sense that we have some object (e.g.
Use python to solve this question please! Part 2: Dictionaries (1 point) Dictionaries are like lists in the sense that we have some object (e.g. number, string, etc.) occupying a position in the dictionary. However, dictionaries are unique in that we can refer to each object/element by a "key". For example, in the dictionary "example_dict in the cell below, the key 'red corresponds to the number -2, the key" "green" corresponds to the string "beach ball and so on. IMPORTANT: You cannot refer to elements in a dictionary using indices (e.g. example dictj0] or example_ dict3) like you can with lists (unless you've defined your keys to be numbers). You must use the keys to refer to specific elements Also note the use of curty braces instead of brackets; this is another difference between lists and dictionaries. The following table serves as a reference for how to create and manipulate dictionaries (you made need to scroll side to side). Container Mutable Type Immutable Adding Values to Container Removing Values from Cont Immutable Without Values Initializtion With Values del #Ais method renove entries associated vit the given key dicthane[ keySame ] s student['major]-'computer Seience >>> student-('nane' John Doe> ('name' John Doe,age'1 22, college' i MSU'major' 'Computer Science) Dictionary Mutable student-) Here's the example mentioned above: s how to define a "dictionary" in Python note that the keys are strings "beach ball*, "blue": 25) ' : Here i example_dict- ("red": -2, "orange" Cata""green" Part 2: Dictionaries (1 point) Dictionaries are like lists in the sense that we have some object (e.g. number, string, etc.) occupying a position in the dictionary. However, dictionaries are unique in that we can refer to each object/element by a "key". For example, in the dictionary "example_dict in the cell below, the key 'red corresponds to the number -2, the key" "green" corresponds to the string "beach ball and so on. IMPORTANT: You cannot refer to elements in a dictionary using indices (e.g. example dictj0] or example_ dict3) like you can with lists (unless you've defined your keys to be numbers). You must use the keys to refer to specific elements Also note the use of curty braces instead of brackets; this is another difference between lists and dictionaries. The following table serves as a reference for how to create and manipulate dictionaries (you made need to scroll side to side). Container Mutable Type Immutable Adding Values to Container Removing Values from Cont Immutable Without Values Initializtion With Values del #Ais method renove entries associated vit the given key dicthane[ keySame ] s student['major]-'computer Seience >>> student-('nane' John Doe> ('name' John Doe,age'1 22, college' i MSU'major' 'Computer Science) Dictionary Mutable student-) Here's the example mentioned above: s how to define a "dictionary" in Python note that the keys are strings "beach ball*, "blue": 25) ' : Here i example_dict- ("red": -2, "orange" Cata""green
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
