1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
WINSTONCH [101]
3 years ago
15

Write a function fight(first_pokemon, second_pokemon) that takes the dictionaries for two pokemon and computes the winner of a f

ight. The winner of the fight must be the pokemon with the greatest sum of all stats. You must also write a stats(pokemon) function that takes a pokemon's dictionary and returns an integer representing the sum of that pokemon's stats.
Computers and Technology
1 answer:
igomit [66]3 years ago
4 0

Answer: provided in the explanation section

Explanation:

This is actually quite easy to go,i ask that you follow it carefully.

CODE is meant for python3+

CODE

def stats(pokemon):

   total=0

   #loops over the stats list

   for stat in pokemon["stats"]:

       # adds the stat to the total

       total+=stat["base_stat"]

   return total

def fight(first_pokemon,second_pokemon):

   #prints the first statemetn

   print(first_pokemon["name"],"has",stats(first_pokemon),"combined stats.",second_pokemon["name"],"has",stats(second_pokemon),"combined stats.")

   #checks if the first_pokemon wins

   if(stats(first_pokemon)>stats(second_pokemon)):

       print(first_pokemon["name"],"wins!")

   #checks if the second_pokemon wins

   elif(stats(first_pokemon)<stats(second_pokemon)):

       print(second_pokemon["name"],"wins!")

   # it is a draw

   else:

       print("It is a draw")

cheers i hoped this helped !!!

You might be interested in
A customer uses an app to order pizza for delivery. Which component includes aspects of the customer's interaction with an enter
MissTica

The available options are:

Understand the customer journey

Identify customer requirements based on their behavior and interactions

Provide a steady stream of marketing-qualified leads to the sales team

Help curate the right kind of content for customers

Provide feedback to the operations team regarding product quality

Answer:

Identify customer requirements based on their behavior and interactions

Explanation:

The component that includes aspects of the customer's interaction with an enterprise platform is "Identify customer requirements based on their behavior and interactions."

The above statement is true because when a customer uses an app to order pizza for delivery, the app can identify the customer's requirements based on the interaction between the customer and the app.

The customer uses the app to ask for what he wants, which is the requirements based on his behavior; the app identifies these wants and acts accordingly. This also shows interactions between the app and the customer.

8 0
3 years ago
What are some areas in Computer Science that make use of multivariate statistical testing or MCM methods? Explain why they are u
Nikolay [14]

Explanation:

Computational modeling is one of the areas of Computer Science that uses mathematical systems to perform multivariate statistical tests to solve highly complex problems in multidisciplinary areas, such as medicine, engineering, science, etc.

An example of the use of multivariate statistical tests is social development research in social science, which uses multiple variables to find more hypotheses and greater coverage between variables.

Multivariate statistical tests have the benefit of making research more effective and providing a more systematic and real view of the study.

6 0
3 years ago
The scope of a variable declared within a for() loop is:
Leni [432]

Answer:

a

Explanation:

The variable declared in the for is accessible only within the for loop  and it goes out of scope once the loop get end

eg : for(int i=1;i<=10,i++) // variable i is declared

{

// variable i is visible only in this block,

}

//After this the variable i goes out of scope

5 0
3 years ago
In windows vista, which process allows you to display two documents side by side?
Semmy [17]
By dragging one tab the the top right corner and holding for a few seconds it will automatically take up a certain proportion of the screen. By doing the same to the left side, the documents will be side by side and ready to multi-task with ease. This process is called "splitting screens".
7 0
3 years ago
Read 2 more answers
Which method is used to edit a function that has been created and inserted into a cell?
8_murik_8 [283]

Answer:

A

Explanation:

A

4 0
3 years ago
Read 2 more answers
Other questions:
  • What is printed by the following program? var isRaining = false; var isCloudy = false; var isSunny = !isRaining &amp;&amp; !isCl
    11·1 answer
  • If data from a DOS system is electronically sent to an EHR or other Windows-based system via an interface to populate an indexed
    7·1 answer
  • Create a program that asks the user to enter grade scores. Use a loop to request each score and add it to a total. Continue acce
    9·1 answer
  • State two function of protein in the body
    8·1 answer
  • [1] Our son has started playing organized T-ball, a beginner’s version of baseball. [2] “Organized” is what parents call it, any
    9·2 answers
  • 1st answer will get brainliest!
    13·2 answers
  • Which of these lines of code will increment a variable?
    11·1 answer
  • he superclass Student contains: a constructor that accepts a String corresponding to the name of the school the student attends
    15·1 answer
  • Repeated execution of a set of programming statements is called repetitive execution.
    7·1 answer
  • What defines the scope of a project?
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!