Answered step by step
Verified Expert Solution
Link Copied!

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!

image text in transcribed

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 statistic

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

Seven NoSQL Databases In A Week Get Up And Running With The Fundamentals And Functionalities Of Seven Of The Most Popular NoSQL Databases

Authors: Aaron Ploetz ,Devram Kandhare ,Sudarshan Kadambi ,Xun Wu

1st Edition

1787288862, 978-1787288867

More Books

Students also viewed these Databases questions

Question

1. How do most insects respire ?

Answered: 1 week ago

Question

1. Discuss the five types of learner outcomes.

Answered: 1 week ago