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
In a stack, if a user tries to remove an element from an empty stack it is called.
Sergeu [11.5K]

In a stack, if a user tries to remove an element from an empty stack it is called underflow.

<h3>What is underflow?</h3>

When we attempt to pop (remove) anything off the stack but there is nothing there to remove, stack underflow occurs. The computer will kind of sound an alert as a result of what we taught it to do, which is impossible.

The options are:

1) Underflow

2) Empty collection

3) Overflow

4) Garbage collection

As we know,

When an item is requested from the stack but the stack is empty, an error situation arises.

Thus, in a stack, if a user tries to remove an element from an empty stack it is called underflow.

Learn more about the underflow here:

brainly.com/question/14865058

#SPJ4

5 0
2 years ago
Define the following term. data, database, DBMS, database system, data- base catalog, program-data independence, user wen', DBA,
wolverine [178]

Answer:

data - Any form of value in a column of a table in a relational database.

DBMS - Short for Database management system, which is a software that can be used to create, manipulate and view databases, e.g. MS SQL Server.

database system - Same as DBMS.

database catalog - Place where the metadata of a Database, its tables, users etc. exists e.g. date created, size, number of columns etc. Also known as Data Dictionary.

program-data independence - Program-data independence refers to the capability of leaving data intact and accessible regardless of modifications to the database that contains the data.

DBA - Short for Database Administrator, person responsible for maintaining the database. Its main responsibility is to keep the data clean and safe i.e. data doesn't contain wrong or invalid data, and is safe from viruses and is backed up.

end user - Anyone who is not directly interacting with a database, but through some software like website and mobile application.

persisten object - An object of a class in a program, that interacts with the underlying database and is responsible for manipulating the database connected to.

transaction-processing system - A transaction process system is part of a software, responsible for making sure critical business transactions, like crediting or debiting money, either goes through cleanly or doesn't at all.

CRUD are the four main types of operations one can do in a database environment. It stands for creating, reading, deleting and updating.

Explanation:

4 0
3 years ago
The difference between a want and a need is a want is not necessary for survival. Things necessary for survival are known as ___
Zarrin [17]
A.Needs since they are necessary and needed for survival 
8 0
3 years ago
Write Python algebraic expressions corresponding to the following statements: (a) The sum of the first five positive integers (b
lbvjy [14]

Answer:

#part a

#sum of first 5 positive number

Sum=5*(5+1)/2

print("sum of first 5 positive integer is: ",Sum)

#part b

# declare age of all

Sara_age=23

Mark_age=19

Fatima_age=31

ave_age=(Sara_age+Mark_age+Fatima_age)/3

print("average age of Sara,mark and Fatima is: ",ave_age)

#part c

#find number of times

no_of_times=int(403/73)

print(" number of times when 73 goes into 403 is: ",no_of_times)

#part d

#find remainder

rem=403%73

print("when 403 is divided by 73 then remainder  is: ",rem)

#part e

#calculate 2 to pawer 10

two_pow=2**10

print("2 to power  10 is: ",two_pow)

#part f

#declare height of both

sara_h=54

mark_h=57

diff_h=abs(sara_h-mark_h)

print("The absolute difference between height of Sara and Mark is: ",diff_h)

#part g

#find the minimum among three

print("lowest price among the three($34.99,$29.95,$31.50) is: $",min(34.99,29.95,31.50))

Explanation:

In part a, sum of first 5 positive number is calculated as 5*(5+1)/2.In part b, add the age of three and divide it  by 3. In part c, use "/" to find number of times 73 goes into 403.In part d, use "%" to find remainder when 403 is divide by 73.In part e, 2 to the 10th power is calculated as 2**10.In part f, use abs() to find the absolute  difference.In part g, min() function is used to find lowest among the 3 prices.

Output:

sum of first 5 positive integer is:  15.0                                                                                  

average age of Sara,mark and Fatima is:  24.333333333333332                                                                

number of times when 73 goes into 403 is:  5                                                                              

when 403 is divided by 73 then remainder  is:  38                                                                          

2 to power  10 is:  1024                                                                                                  

The absolute difference between height of Sara and Mark is:  3                                                            

lowest price among the three($34.99,$29.95,$31.50) is: $ 29.95

5 0
4 years ago
Write an if/else statement that compares the variable age with 65, adds 1 to the variable seniorCitizens if age is greater than
Oduvanchick [21]

if age >= 65:

seniorCitizens = seniorCitizens + 1

else:

nonSeniors = nonSeniors + 1

6 0
3 years ago
Other questions:
  • Whichof the following is not a standard method called as part of the JSPlife cycle?jspInit()jspService()_jspService()jspDestroy(
    12·1 answer
  • Which of the following statements is the least abstraction of the World Wide Web?
    15·1 answer
  • 38. Which of the following best describes why e-mail spoofing is easily executed? a. SMTP lacks an adequate authentication mecha
    15·1 answer
  • Key differences between software and books include all of the following except
    15·2 answers
  • The function below takes two integer parameters: low and high. Complete the function so that it prints the numbers from low to h
    14·1 answer
  • Generally speaking, problems are rarely caused by motherboards. However, there are some instances in which a motherboard can fai
    12·1 answer
  • For this program you will build a simple dice game called Pig. In this version of Pig, two players alternate turns. Players each
    6·1 answer
  • How do I use brainly.<br> What is brainliest.<br> And what is the rating thing about
    6·2 answers
  • Create a set of functions that compute the mean, median, and mode of a set of
    8·2 answers
  • Place a check next to each of the choices that describe an example of proper ergonomics. (more than 1 answer)
    7·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!