Write a function called find_continents () which takes as parameterls: A dictionary in the format...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
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): 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):
Expert Answer:
Related Book For
Modern Database Management
ISBN: 978-0133544619
12th edition
Authors: Jeff Hoffer, Ramesh Venkataraman, Heikki Topi
Posted Date:
Students also viewed these programming questions
-
Write a function that will return a full name string when passed a first name string, a middle name or initial string, and a last name string. If the middle initial is blank, there should be only one...
-
Download the video file called CH02_TestVideo and time how long it takes. a. What is the files size in MB? If the file size is represented in gigabytes (GB), multiply that number by 1,000 to convert...
-
Write a function called hms_to_secs() that takes three int values for hours, minutes, and secondsas arguments, and returns the equivalent time in seconds (type long). Function prototypes is given...
-
If we define the median of a sequence as a number so that exactly as many elements come before it in the sequence as come after it, fix the program in 4.6.3 so that it always prints out a median....
-
Why are free capital flows desirable?
-
(Adjusting Entries) Karen Weller, D.D.S., opened a dental practice on January 1, 2005. During the first month of operations the following transactions occurred. 1. Performed services for patients who...
-
What are the different types of schemes associated with complex frauds?
-
In preparation for significant international operations, ABC Co. has adopted a plan to gradually shift to the same accounting methods as used by its international competitors. Part of this plan...
-
Market Dynamics (10 Points) Between 1980 and 1990, the number of employed women grew sharply but the number of women employed as secretaries actually fell. There are two theories as to why this...
-
One of the products of the G.A. Tanner Company is a special kind of toy that provides an estimated unit profit of $3. Because of a large demand for this toy, management would like to increase its...
-
12. Let 1 -1 1 -1 0 -1 2 and C = B = 1 A = 3 1 3 -2 3 Show that A(BC) = (AB)C and (AB)" = B" AT .
-
1. Outline the primary goal of a persuasive claim to get your audience to accept your point of view on immigration. 2. Must refute opposing arguments rather than just ignore them
-
A patient was complaining of fever, chills, cough and headache. His lips and fingernails turned grey. What diagnosis would you make? Name the two causal organisms and state the category to which...
-
Respond to the ethical scenario o r respond to the presentation in a Global Table. All responses should be one full page that is typed and double-spaced. Ethical scenarios 1.Recently, Professor...
-
Which technological, organizational, and financial innovations caused the rise of hospitals in the twentieth century?
-
You work as a social media marketer at a brand management company in downtown Toronto with two other people you know from your college days at Conestoga. The three of you often work in teams in order...
-
the same 1. Suppose firm 1 and firm 2 each produce e product and face a market demand curve described by Q = 5000 - 200 P. Firm 1 has a unit cost of production c equal to 6 whereas firm 2 has a...
-
Use the method of Example 4.29 to compute the indicated power of the matrix. 1 0 1
-
Identify at least five categories of human activity that are affected by big data and analytics.
-
What are the four main types of NoSQL database management systems?
-
Because Visio does not explicitly show associative entities, it is not clear in Figure 2-22 which entity types are associative. List the associative entities in this figure. Why are there so many...
-
What is the difference between efficiency and effectiveness? Explain why both are valuable to managers.
-
Is there one best style of management? Discuss in terms of managerial functions, roles.
-
How are technology, social media, and other technological advances making a managers job easier? More complex?
Study smarter with the SolutionInn App