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]
2 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]2 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
When would it be necessary to edit the information shown on an electronic business card?
Goryan [66]

Answer:

Really depends on your situation. If you specified, I'd have an asnwer

3 0
3 years ago
Read 2 more answers
If you have a database with birthdates, and you would like to find everyone who was born before June 16, 1967, what would you en
Tcecarenko [31]

Answer:

<June 16,1967

Explanation:

7 0
3 years ago
Read 2 more answers
What are the trinity of the computer system
barxatty [35]

Answer:

I think the answers are input, processes, output

6 0
3 years ago
Technician A says that the TP sensor signal voltage should be about 0.5 volt at idle and increase to about 2.5 volts at wide-ope
swat32

Answer:

Both are right.

Explanation:

4 0
3 years ago
What is big data<br>please explain why it is called big and do the data necessarily mean numbers​
harkovskaia [24]

<u>Answer:</u>

<em>Big data is to analyze large complex data.</em>

<u>Explanation:</u>

It is basically a data processing software which has overcome the disadvantage which we had in <em>the classical software where it was not able to manage huge data in a faster mode.</em>

The mean of an informational collection is found by including all numbers in the informational index and afterwards partitioning by the number of qualities in the set.

<em>To answer the question is the word big points to a number? I would say yes, since it can handle large amount of data, it is so called “Big data.</em>

The middle is the center worth when an informational collection is requested from least to most noteworthy. <em>The mode is the number that happens frequently in an informational index.</em>

6 0
3 years ago
Other questions:
  • Consider this scenario: A major government agency experiences a data breach. As a result, more than 100,000 personal records are
    7·2 answers
  • Custom parameters 1, 2 and 3 provide the same end value for all keywords. true or false?
    14·1 answer
  • Elise has just edited two photos of her cat and three different photos of her dog. She needs to save all five of these photos in
    5·2 answers
  • What formatting option is easiest to read when printed out
    12·1 answer
  • Sorting and filtering are two ways to _____ data.
    7·2 answers
  • What is a printed copy of computer output called
    10·2 answers
  • Optimizing a network to handle more traffic by adding new specialized software is an example of ______ scaling. Adding additiona
    9·1 answer
  • When classified data is sent over an unclassified network, what is this incident called?
    5·1 answer
  • The first project that this position will work on is an embedded sensor that will send readings periodically to the cloud, and h
    9·1 answer
  • HELPPPP PLEASE HURRY
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!