Question: In this homework, you are supposed to create a mini game where the player is stuck on a magical island. The only way to get
In this homework, you are supposed to create a mini game where the player is stuck on a magical
island. The only way to get out of the island is to beat the wild monster!
Write a python program which has two functions:
performattack: This function calculates the health points hp of the player and the
monster after they attack each other. Every attack causes a random hp loss between
on them. The function takes the players and monsters current hp as
parameters and returns the resulting hp of the user and monster after the damage in
that round.
battle: This function first randomly generates the players and the monsters initial hp
between Then, they start attacking each other until one of them beats the
other ie when hp The function prints their hp respectively in each round calling
the performattack function. At the end, it prints the winner.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
