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
What are the two most popular applications of theInternet?
fiasKO [112]

Answer:

1) Electronic mailing

2) Web browsing

Explanation:

Electronic mail: For hundreds of millions of individuals, e-mail has become an significant component of private communications, many of whom have substituted it with letters or phone calls. E-mail has become an significant advertising medium in company, especially in cases where time-sensitive demand for products and services.Tickets for an upcoming sporting event, for instance, are sold by sending fans an e-mail message with ticket availability data and prices.

Web browsing: The web browsing is another critically important Internet application. The world of internet is filled with the immense of knowledge, subjects, and solutions. The user browse the internet to look out for the related queries, researches and lot other things.

8 0
3 years ago
A software program that allows a programmer to type in code. modern versions usually make it easy to format the code on the scre
Daniel [21]
Hi!

Software programs which programmers use to write code are known as IDE's. IDE stands for an integrated development environment.

It is also sometimes called an interactive development environment.

Hopefully, this helps!
4 0
3 years ago
What is the difference between a switch and a hub?
marta [7]

Explanation:

A hub is used to send the message from one port to other ports.It does not know the specific address of the destination where the message needs to send.it works on Physical layer of the OSI model(layer 1).

A switch can handle data and it knows the specific address of the destination.A switch works on the data link Layer of the OSI model(layer 2).

8 0
3 years ago
You’ve been stuck in bumper-to-bumper traffic for nearly an hour on a hot summer day. The temperature warning light has just com
nekit [7.7K]

Answer:

In a bumper-to-bumper traffic, when the engine starts overheating the situation can be handled by tapping the accelator which will revive the engine.

Explanation:

Overheating of engine can be due to many reasons. But one should know what to do when an engine overheats in a traffic. Bumper-to-bumper traffic is when the cars are so close in traffic that they touch each other. This usually happens when there's a traffic for a long time or on very busy lane. During summer times, it is important to keep checking the engine temperature to avoid any problem.

When one is stuck in bumper-to-bumper traffic with overheating engine, then there are some meausres that one can take. They are:

  • To put the car on park or neutral mode of driving and tap the accelator which will revive the engine.
  • The heat can be disperse by rolling down the window and turn the heater up. It will disperse the heat.

6 0
3 years ago
Where can elicitation techniques be used?
Nikitich [7]

Answer:

An elicitation technique is any of a number of data collection techniques used in anthropology, cognitive science, counseling, education, knowledge engineering, linguistics, management, philosophy, psychology, or other fields to gather knowledge or information from people.

Explanation:

3 0
2 years ago
Other questions:
  • The strFirstName and strLastName variables contain the strings "Jane" and "Jones," respectively. Which of the following statemen
    14·1 answer
  • The critical path of a network is the A. shortest time path through the network. B. path with the most activities. C. longest ti
    8·1 answer
  • Write and run a Python program that asks the user for a temperature in Celsius and converts and outputs the temperature in Fahre
    10·1 answer
  • On a hard disk each track is divided into invisible wedge-shaped sections called _______
    15·1 answer
  • This LEGENDARY character made a much-celebrated comeback in 2017. What was the name of the villain he faced in this epic tale?
    7·2 answers
  • If you do not specify any criteria in a delete query, Access will delete all the records in the table. Truth or False
    11·1 answer
  • Courses that enable students to begin jobs that require course completion certificates are know as
    8·1 answer
  • The table button is present in the ……… tab.​
    14·2 answers
  • All the network nodes are connected to each other
    8·1 answer
  • I'm getting pretty desperate plz help me, I'll give brainiest, and ill make a free question worth 100 points this is for coding
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!