Question: PYTHON 3 for these functions Functions You must implement the following functions. Examples can be found later in this document (under Examples). Methods NEVER modify

PYTHON 3 for these functions

PYTHON 3 for these functions Functions You must implement the following functions.Examples can be found later in this document (under "Examples"). Methods NEVER

Functions You must implement the following functions. Examples can be found later in this document (under "Examples"). Methods NEVER modify the given database, but some functions create a new database. read info file(filename): This is only one of two functions that deals with reading a file. It accepts the file name as a string, assume it is a CSV file in the format described above for an "info" file. The function needs to open the file, read all the described pokemon, and create a dictionary of pokemon in the INFO FORMAT returns the dictionary it creates. Note: the first line of the file is always a "header" line which does not corresponds to any pokemon; the last line ofthe file always ends with a newline Nn Special case: Name field in the input file might contain one comma as part of the string, for example, Tornadus, (Incarnate Form)". You can assume the name can have at most one comma and all other fields do not have any comma. read stats file(filename): This is the other one of two functions that needs to deal with reading a file. It accepts the file name as a string, assume it is a CSV file in the format described above for a "stats" file. The function needs to open the file, read all the described pokemon, and create a dictionary ofpokemon in the STATS FORMAT It returns the dictionary it creates. Note: the first line of the file is always a "header" line which does not corresponds to any pokemon; the last line of the file always ends with a newline ('Vn') combine databases (info db, stats db): is function takes two dictionaries (one in INFO FORMAT and one in STAT FORMAT) and combines them into a final dictionary "database" (described in the previous section). Items from one dictionary that do not appear in the other should be discarded. It returns the combined dictionary. NOTE: All functions below will be expecting a full database, not an info or stats dictionary pokemon by types(db, types): This function accepts a pokermon database db and a list of strings types. It needs to build and return a new database with only pokemon of the given types. NOTE: you must not change the original database with this function pokemon by hp defense(db, lowest hp, lowest defense): Given a pokemon database db and two integers indicating the lowest hit points (hp and lowest defense stats, this function creates and returns anew database consisting only of pokemon with an hp lowest hp and a defense lowest defense. NOTE u must not change the original database with this function get types(db): Given a database db, this function determines all the pokemon types in the database. It returns the types as a list of strings, asciibatically sorted (in order based on the ASCII character values). The sorted() function or sort() method can be helpful here. count by type(db,type): Given a database db and a single pokemon type (as a string), this function collects and reports three statistics l.how many pokemon in db have type as their only type 2. how many dual-type pokemon in db have type as one of their two types 3.a sum of the two values (1 and 2) above A tuple of (single type count, dual type count, total count) should be returned

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!