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
How to connect an Apple Watch series 3 to your iPhone (ASAP)
inn [45]

Im not sure but okay

7 0
3 years ago
Read 2 more answers
Why don’t the ads on Brainly load anymore
vovikov84 [41]
Umm I really have no idea
7 0
3 years ago
Read 2 more answers
By Carl Sandburg
Eva8 [605]
The answer is 1 because the poet uses personification.
6 0
3 years ago
What is the printout of the call nPrint("a", 4)?
satela [25.4K]

Answer:

aaaa

Explanation:

We have a function nPrint which return type is void, it means it returns nothing.

we declare the two parameters, one parameter is string type and the second parameter is an integer type.

Then, it has a while loop that executes the statement again and again until the condition not FALSE.

Let dry run the code:

First, call the function nPrint("a", 4) bypassing the value in the argument.

then, the value receives by the parameters, the message contains "a" and n contain 4. After that, while loop checks the condition 4 > 0, which is TRUE and the program starts executing the statement.

The program prints the message on the screen "a" and then decreases the value of n by 1. So, the value of n becomes 3.

The above process repeats for the value of n = 3, 2, 1

and print the message "aaaa".

then, the condition becomes false and the program terminates the loop.

Therefore, the answer is aaaa

5 0
3 years ago
1. It defines the amount of white space that appears at the top, bottom, left, and right edge of
LekaFEV [45]

Answer:

Margin is the correct answer to the given question .

Explanation:

The main objective of the margin is to setting the white space that are showing up at the top , bottom, left and the right corners of the file or the document .

Following are steps to setting the white space that are showing up at the top , bottom, left and the right corners of the file or the document

  • Firstly click on the page layout  options  .
  • After that click on the margin tab .In this tab you will given the the top, bottom, left, and right margin according to your need
  • Finally click on ok to finish them .
8 0
3 years ago
Other questions:
  • Helppppppppppppppppppp
    11·1 answer
  • What test is most similar to binary​
    9·1 answer
  • You are the IT administrator for a small corporate network. Recently, you added a web server that runs services that need to be
    12·1 answer
  • What is the financial aspect for a business as to what database software they will buy?
    6·1 answer
  • Windows displays a(n)
    11·1 answer
  • Someone please tell me please y my ps4 controller won’t charge:(
    12·2 answers
  • Cho 3 lớp như hình, viếtchương trình thực hiện các chức năng sau:
    15·1 answer
  • Additional metadata data is stored alongside the binary colour values for each pixel. Give two examples of metadata?
    9·1 answer
  • Which of these can be a problem for people with accessibility issues? Select 4 options.
    7·1 answer
  • To behave ethically means
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!