Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

IN python File is down below 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

IN python

image text in transcribed

File is down below

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

Write a function called count_types () which takes as parameter(s): A dictionary in the format of the pokemon database as described in Q1 A list 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 Q3 to see that list), the resulting dictionary should be: {'dragon': 1, 'rock': 4, 'normal': 4, 'flying': 3, 'fire': 1, 'electric': 2, 'bug': 3, 'ghost': 2, 'water': 9, 'poison': 6, 'fairy': 1, 'psychic': 3, 'ground: 3, grass': 2, 'fighting': 4} Also, note that this function must not change the pokemon database or the given list of pokemon names in any way

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

Database Driven Web Sites

Authors: Joline Morrison, Mike Morrison

2nd Edition

? 061906448X, 978-0619064488

More Books

Students also viewed these Databases questions

Question

Describe what a buyer does. Name at least five activities.

Answered: 1 week ago