Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a function called pokemon_in_continent) which takes as parameter(s): A dictionary in the format of the pokemon database as described in Q1 The name of

image text in transcribedimage text in transcribed

Write a function called pokemon_in_continent) which takes as parameter(s): 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): ['gyarados', 'nidorina' 'magmar', 'jigglypuff ' 'machoke ', 'machamp', 'dragonair', 'slowbro ', 'machop'venomoth', 'tentacruel', 'parasect' omanyte''poliurath', 'muk', 'hitmonlee', 'vaporeon', 'tangela', 'gengar ' 'nidoranmale ', 'venusaur ', 'onix', 'nidoking', 'golem ', 'aerodactyl', tauros', 'metapod, 'electrode', 'lapras', 'psyduck', 'blastoise', nidoqueen', 'alakazam', 'cubone','magikarp' 'kabutops', 'kakuna', 'poliwag''marowak', 'rhydon', 'kangaskhan', 'zubat ', 'dodrio', 'persian', 'pikachu', 'meowth', 'drowzee, 'gastly' Also, note that this function must not change the pokemon database in any way. Evaluation 1 mark: The function parameters and return value are the correct data type 2 marks: All of the pokemon on the given continent are found and placed in the list 1 mark: For a good function docstring def read_pokedata(fname): param fname: a string indicating the location of pokemon data return: a database that stores all data with open(fname) as f for rec in f.readlines) rec rec.strip).split("," key rec te] d[key] rec[1:] return d

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Google Analytics 4 The Data Driven Marketing Revolution

Authors: Galen Poll

2024th Edition

B0CRK92F5F, 979-8873956234

More Books

Students also viewed these Databases questions

Question

Explain the concept of shear force and bending moment in beams.

Answered: 1 week ago