Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started