Answered step by step
Verified Expert Solution
Link Copied!

Question

00
1 Approved Answer

The above code is the correct code for Q1. Please help with Q2 which is described above. Write a function called ti nd_continents) which takes

image text in transcribedimage text in transcribedimage text in transcribedThe above code is the correct code for Q1. Please help with Q2 which is described above.

Write a function called ti nd_continents) which takes as parameter(s): 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): C'Oceania, 'Asia', 'South America', 'North America', 'Africa Antarctica', 'Europe ' Also, note that this function must not change the pokemon database in any way. 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 war e ,water,Antarctica blastoise.water.Africa,South. America caterpie,bug,0ceania metapod.bug.Asia.Af.rica.Europe, outh. 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 Ridgeotto.fling.Europe,..sia pidgeot.flying.Europe,Oceania,Asia rattata.normal,South. America, Europe, Antarctica raticate,normal,Oceania spearow.flying,South. America,North America, Antarctica, Europe ekans,poison,Europe,0ceania,North America, Asia arbok,poison,South America pikachu,electric,North America,Oceania,Africa raichu,electric,North America sandshrew,around,Asia,North America, South America sandslash,around,Asia,South America,North America nidoranfemale,poison,Asia def read_pokedata(fname): iparam 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[0] d [key] rec[1:] returnd print(read_pokedata("pokemonLocations.txt")) Write a function called ti nd_continents) which takes as parameter(s): 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): C'Oceania, 'Asia', 'South America', 'North America', 'Africa Antarctica', 'Europe ' Also, note that this function must not change the pokemon database in any way. 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 war e ,water,Antarctica blastoise.water.Africa,South. America caterpie,bug,0ceania metapod.bug.Asia.Af.rica.Europe, outh. 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 Ridgeotto.fling.Europe,..sia pidgeot.flying.Europe,Oceania,Asia rattata.normal,South. America, Europe, Antarctica raticate,normal,Oceania spearow.flying,South. America,North America, Antarctica, Europe ekans,poison,Europe,0ceania,North America, Asia arbok,poison,South America pikachu,electric,North America,Oceania,Africa raichu,electric,North America sandshrew,around,Asia,North America, South America sandslash,around,Asia,South America,North America nidoranfemale,poison,Asia def read_pokedata(fname): iparam 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[0] d [key] rec[1:] returnd print(read_pokedata("pokemonLocations.txt"))

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered 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

Students also viewed these Databases questions