Answered step by step
Verified Expert Solution
Question
1 Approved Answer
PYTHON! Please please help it would be greatly appreciated!! The info file is now included Pokemon: We will use three different representations for a Pokemon
PYTHON! Please please help it would be greatly appreciated!! The info file is now included
Pokemon: We will use three different representations for a Pokemon inside our programs, but all three will be based on a tuple with values in some order. The first format (based on the information in an "info" file) will be called INFO FORMAT and will consist of a key-value pair structured as the following examples. name: (id, type1, type2, generation, legendary) 'Bulbasaur 1, Grass Poison 1, False) 'Charmander (4 Fire None, 1, False) The second format (based on the information in a "stats" file) will be called STATS FORMAT and will consist of a key-value pair structured as follows id: (hp, attack, defense, speed) 1: (45, 49, 49, 45) The final format for a Pokemon will combine the two prior formats into a format for our DATABASE (see next section and will consist of a key-value pair with the following structure: name: (id, type1, type2, hp, attack, defense, speed, generation, legendary) 45, 49, 49, 45, 1, False) "Bulbasaur 1, Grass Poison Note that name, typel, and type2 fields are strings, id, generation, and all the stats are integers, and the Pokemon's legendary status is a boolean. Additionally, for pokemon that aren't dual type, the 2nd type is set to be None. (Also notice that none of the formats duplicate the key as part of the data, as duplicated information is rarely a good idea) Database: a "database" of Pokemon can store multiple Pokemon by name. Our database will be a dictionary whose keys are Pokemon names, and whose values are tuples of interesting information about the Pokemon (in the combined final database format shown above). Only Pokemon with stored information and statistics may be present sample db (1 Poison 1, False), Bulb 49, 49, 45 Grass 45 (4 Fire 39, 52, 43, 65 1, False), "Charmander None (6, Fire Flying 78, 84, 78,100, 1, False), "Charizard" (146, Fire Flying 90, 100, 90, 90, 1, True) Moltres (169 Poison Flying 85, 90, 80, 130, 2, False), Crobat "Tornadus, (Incarnate Form) (641 Flying None 79,115, 70,111 5, True), Reshiram (643, Dragon Fire 100,120,100, 90, 5, True) 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. Pokemon: We will use three different representations for a Pokemon inside our programs, but all three will be based on a tuple with values in some order. The first format (based on the information in an "info" file) will be called INFO FORMAT and will consist of a key-value pair structured as the following examples. name: (id, type1, type2, generation, legendary) 'Bulbasaur 1, Grass Poison 1, False) 'Charmander (4 Fire None, 1, False) The second format (based on the information in a "stats" file) will be called STATS FORMAT and will consist of a key-value pair structured as follows id: (hp, attack, defense, speed) 1: (45, 49, 49, 45) The final format for a Pokemon will combine the two prior formats into a format for our DATABASE (see next section and will consist of a key-value pair with the following structure: name: (id, type1, type2, hp, attack, defense, speed, generation, legendary) 45, 49, 49, 45, 1, False) "Bulbasaur 1, Grass Poison Note that name, typel, and type2 fields are strings, id, generation, and all the stats are integers, and the Pokemon's legendary status is a boolean. Additionally, for pokemon that aren't dual type, the 2nd type is set to be None. (Also notice that none of the formats duplicate the key as part of the data, as duplicated information is rarely a good idea) Database: a "database" of Pokemon can store multiple Pokemon by name. Our database will be a dictionary whose keys are Pokemon names, and whose values are tuples of interesting information about the Pokemon (in the combined final database format shown above). Only Pokemon with stored information and statistics may be present sample db (1 Poison 1, False), Bulb 49, 49, 45 Grass 45 (4 Fire 39, 52, 43, 65 1, False), "Charmander None (6, Fire Flying 78, 84, 78,100, 1, False), "Charizard" (146, Fire Flying 90, 100, 90, 90, 1, True) Moltres (169 Poison Flying 85, 90, 80, 130, 2, False), Crobat "Tornadus, (Incarnate Form) (641 Flying None 79,115, 70,111 5, True), Reshiram (643, Dragon Fire 100,120,100, 90, 5, True) 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 databaseStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started