Question: Project function 5 : battle With the functions we have created so far, we can now finally start creating our battle simulator. This function should

Project function 5: battle
With the functions we have created so far, we can now finally start creating our battle simulator.
This function should take in two Pokemon pkmn1, and pkmn2 as its parameters, and it should output the name of the Pokemon which wins the battle or 'Draw'
Note that we will ignore the cases where one Pokemon can take infinite hits from another Pokemon. We will just consider pairs of Pokemon that can both do non-zero effective damage to each other.
The function should return the name of the Pokemon that can take more hits than the other. If both Pokemon can take the same number of hits, the Pokemon with the higher speed wins. If they both have the same speed, then the
function should return 'Draw' . This should sound familiar, because the compare_speed function you wrote in the lab does exactly that.
Points possible: 8.0
[757]: 1 def battle(pkmn1, pkmn2):
2 pass # TODO: replace with your code
[758]: 1 student_grader.check("battle")
Make sure you saved the notebook before running this cell. Running check for battle...
Errors:
Student code does not use: num_hits
Student code does not use: compare_speed
Test case failed: Output of battle is incorrect when pkmn1 can take more hits
Project function 5 : battle With the functions we

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!