Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Write a function called find_continents () which takes as parameterls: A dictionary in the format of the pokemon database as described in Q1 This
Write a function called find_continents () which takes as parameterls: A dictionary in the format of the pokemon database as described in Q1 This function should construct and return a list of all the different continents where it is possible to find pokemon. Each entry in the list should be unique; in other words, don't add the same continent twice even if you can find multiple kinds of pokemon there. For the input file you were given, the resulting list should be (though not necessarily in this order): Purpose: To practice iterating over nested compound data and accessing different dictionary fields Degree of Dificulty: Easy. Write a function called pokemon_ in continent () which takes as parameterls): A dictionary in the format of the pokemon database as described in Q1 The name of a continent, as a string The function should construct and return a list containing the names of all of the pokemon that can be found on the given continent For example, for the input file you were given, if the continent is "Africa". the resulting list should be (though not necessarily in this order): Degree of Difficulty: Moderate. Write a function called count_ types () which takes as parameterls) A dictionary in the format of the pokemon database as described in Q1 A ist of pokemon names (as strings) This function should construct and return a dictionary where each key is a pokemon type (e.g. grass or fire, etc.) and the value for that key is the number of pokemon of that type in the given list of pokemon names. Recall that pokemon type was one of the fields for each pokemon record in the database. For example, using the sample list of all of the pokemon from "Africa" (see 03 to see that list), the resulting dictionary should be: Degree of Difficulty: Easy if you did everything right so far Now it's time to put all your functions together to print out a summary report of how many and what types of pokemon you can find on each continent. In the main part of your program, write code that will print to the console the name of each continent, the TOTAL number of different pokemon that can be found on that continent followed by the counts for each pokemon type on that continent. For example, the format for your output might look something like this: bulbasaur,grass,South America ivysaur,grass,Asia, Antarctica venusaur,grass,Africa,South America charmander, fire,North America,Oceania charmeleon,fire,South America charizard,fire,Oceania squirtle,water,Oceania wartortle,water,Antarctica blastoise,water, Africa,South America caterpie,bug,Oceania metapod,bug, Asia, Africa, Europe,South America butterfree,bug, Antarctica,Oceania,South America weedle,bug, Europe,South America, Asia kakuna, bug,South America,Oceania,Africa, North America beedrill,bug,North America, Asia,Oceania, Antarctica pidgey,flying,Antarctica,Europe,Oceania, South America pidgeotto,flying,Europe,Asia pidgeot,flying,Europe,Oceania,Asia rattata,normal,South America, Europe,Antarctica raticate,normal,Oceania spearow,flying,South America,North America, Antarctica, Europe fearow, flying, Asia,Antarctica ekans,poison, Europe,Oceania,North America, Asia arbok,poison,South America pikachu, electric, North America,Oceania, Africa raichu,electric,North America sandshrew,ground, Asia, North America,South America sandslash,ground, Asia,South America, North America nidoranfemale,poison,Asia nidorina,poison,Africa,Europe,South America, Antarctica nidoqueen,poison,Africa,South America nidoranmale,poison,Asia, Africa,South America, North America nidorino,poison, Antarctica nidoking,poison,Africa,South America, Antarctica,Oceania clefairy,fairy, Asia clefable, fairy,Europe,North America vulpix,fire, North America, Antarctica,Oceania ninetales, fire,North America,Asia jigglypuff,fairy,Asia,Oceania,Europe,Africa wigglytuff, fairy, North America,Asia zubat,flying, Africa, Europe,Oceania, Asia golbat, flying, South America, Antarctica Purpose: To practice the concept of dictionary as a database Degree of Difficulty: Moderate. Before starting this question, first, download the data file pokemonLocations.txt from the class Moodle. Make sure to put it in the same folder as your a5. py python code. Write a function called read pokedata () that takes as parameter(s):
Step by Step Solution
★★★★★
3.45 Rating (165 Votes )
There are 3 Steps involved in it
Step: 1
PPROG...Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started