Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Python 3 Coding Functions: Below are the functions I need help with, including the extra credit. Thank you! show_of_strength_game(db, team1, team2): Given a database db
Python 3 Coding Functions:
Below are the functions I need help with, including the extra credit. Thank you!
show_of_strength_game(db, team1, team2): Given a database db and two teams (two separate lists of pokemon names), have the teams play out a competition where each pokemon competes against the corresponding pokemon on the other team. Assume all pokemon are listed in the database. A team will "win'' a match if the pokemon on their team has a higher "attack'' stat. If only one team has a pokemon to compete in that slot, that team wins automatically. Return the difference between Team 1's score and Team2's score. For example: Team1 = ["Pokemon1'', "Pokemon2'', "Pokemon3'', "Pokemon4''] Team1 = ["Pokemon5'', "Pokemon6''] [Team1] [Team2] Pokemon1 Pokemon5 # Pokemon5 has higher attack than Pokemon1, therefore Team2 wins Pokemon2 Pokemon6 # Pokemon2 has higher attack than Pokemon6, therefore Team1 wins Pokemon3 # Team2 ran out of pokemon, so Team1 automatically wins Pokemon4 # Team2 ran out of pokemon, so Team1 automatically wins Team1 wins three times, Team2 wins one time, return 3-1 = 2. strongest_pokemon(db, type = None, generation = None): Given a database of pokemon db, determine the pokemon with the highest total of hp, attack, and defense. If the user decides to restrict the type or generation, provide only the strongest pokemon that also meet those criteria. Since ties are possible, return a list of the strongest pokemon by name, asciibatically sorted. Return None if no pokemon meet the specified requirements. Extra Credit top_team_with_best_attackers(db, size=6): Given a database of pokemondband an integersize, determine the best team that can be made (based on their attack only). The team should always havesizemembers unless the number of pokemon in the original databasedbis lower thansize- in which case the team has to include all available pokemon but sorted based on their attack. Break ties asciibetically - lower asciibetical sorting will come first, e.g. if a "Spearow'' and an "Ekans'' have the same attack power, an "Ekans'' will be chosen before a "Spearow''. Return the team as a list of pokemon names sorted by the pokemon's attack statisticStep 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