17.8. ExercisesΒΆ
-
Iterate through the list so that if the character βmβ is in the string, then it should be added to a new list called
m_list
. Hint: Because this isnβt just a list of lists, think about what type of object you want your data to be stored in. Conditionals may help you.
-
The nested dictionary,
pokemon
, shows the number of various Pokemon that each person has caught while playing Pokemon Go. Find the total number of rattatas, dittos, and pidgeys caught and assign to the variablesr
,d
, andp
respectively. Do not hardcode. Note: Be aware that not every trainer has caught a ditto.
-
Below, we have provided a nested list called
big_list
. Use nested iteration to create a dictionary,word_counts
, that contains all the words inbig_list
as keys, and the number of times they occur as values.
-
Provided is a dictionary that contains pokemon go player data, where each player reveals the amount of candy each of their pokemon have. If you pooled all the data together, which pokemon has the highest number of candy? Assign that pokemon to the variable
most_common_pokemon
.