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
what is happening when humans control the breeeding of living things to favor certain desired features
sweet-ann [11.9K]
Selective Breeding is happening.
6 0
3 years ago
What is ASP.NET ?why is it important?
miskamm [114]
<span>ASP.NET is an open-source server-side web application framework designed for web development to produce dynamic web pages.

Without it, we would be lost on the internet, or possibly wouldn't even have internet. Whats the point of Wifi without web pages?</span>
6 0
3 years ago
What are the 3 attributes of information?
Anton [14]

As previously said, the three highly important qualities of validity, accuracy, and completeness can be expanded into the information quality of integrity.

For information to be valuable and to meet the definition of information, it must largely have the characteristics of relevance, availability, and timeliness. Accuracy, completeness, consistency, distinctiveness, and timeliness are five qualities of high-quality information. For information to be accurate and valuable, it must be of high quality. Standard attributes, commonly referred to as global attributes, work with a wide variety of elements. The essential attributes such as accesskey, class, contenteditable, contextmenu, data, dir, hidden, id, lang, style, tabindex, and title are included in them.

Learn more about information here-

brainly.com/question/5042768

#SPJ4

4 0
1 year ago
Digital citizenship is both a right and a {Blank}.
wolverine [178]
Privilege, I believe.
Hope this helps!<span />
6 0
3 years ago
Read 2 more answers
When a router forwards incoming packets closer to their destination hosts, this is called?
il63 [147K]
Port forwarding, I think.
3 0
3 years ago
Other questions:
  • Naseer has inserted an image into his document but needs the image to appear on its own line.
    14·2 answers
  • A computer processor can become extremely hot and must be cooled. A heat sink is placed on top of the processor to extract its h
    13·1 answer
  • What is the name of the file manager in Microsoft Windows. The file manager used in Microsoft Windows is?
    12·2 answers
  • Arrays are described as immutable because they are two dimensional. are arranged sequentially. can be reordered. cannot be chang
    11·1 answer
  • John works in the Sales and Marketing group. Why does his group need to interact with operations management to plan the launch o
    12·1 answer
  • The intellectual property right that gives a creator control of his or her written work is known as what?
    9·1 answer
  • Given an array a, write an expression that refers to the first element of the array .
    5·1 answer
  • How many pieces can be connected on to a to an SPS​
    11·1 answer
  • BRAINLIEST!!! 20 PNTS!!!! HELPP!!!
    12·1 answer
  • How do solar ovens track the sun as it moves during the day?
    15·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!