Question: Do not use any functions or statements that have not been covered in class! TASKS ( 5 pts ) Write a function called a b
Do not use any functions or statements that have not been covered in class!
TASKS
pts Write a function called val that returns the absolute value of a number. Do not
use the builtin absolute value function from the math library.
Signature:
def abval :
#your code
return abval
abval
pts Write a function called circcalc that returns the specified measure of a shape
from two parameters: the radius and the measure sought. Round your answers to the nearest
thousandth. Use
c circumference
a area using
volume of a sphere
If the measure parameter is not any of these, return
Signature:
def circcalcradius shape:
#your code
return
pts Write a function called kindofroots that describes the roots of a quadratic
function from the coefficients and
A function has "two real" roots when the discriminant is positive.
A function has "one real" root when the discriminant is zero.
A function has "two imaginary" roots when the discriminant is negative.
Use your discriminant function from previous PAs to calculate the value. Paste the
function into this file!
Signature:
def kindofrootsa b c:
#your code
return
pts Write a function called stockadvice that determines what to do with a particular
stock from its purchase price and its current price. The first parameter is the purchase price and
the second is the current price.
The advice is "BUY" when the stock is up more than
The advice is "SELL" when the stock is down more than
For a stock that isn't changing very much up more than or down less than the
response should be "HOLD".
Signature:
def stockadvicestartprice, endprice:
#your code
return
pts Write a function called levelup that determines if a video game player has enough
points to get to the next level, given a number of points and the current level. The return value
should be a Boolean.
A player needs to have more than a hundred times the next level's number in order to
levelup
Signature:
def levelup points level:
#your code
return
pts Write a function called levelup that determines if a video game player has
enough points to get to the next level, given a number of points, the current game level, and
their expert level. The return value should be a Boolean.
'beginner' : needs more than one hundred times the next level's number to levelup
'intermediate': needs more than times the next level's number to level up
'expert' : needs more than times the next level's number to levelup
'pro': needs moge than a thousand times the next level's number to level up
Signature:
def leveluppoints level, expertlevel:
#your code
return
pts Write a function called minutes passed that determines the number of minutes
between a start time and an end time. The function takes four parameters representing the
hour and minutes for the start time and the hour and minutes of the end time.
Signature:
def minutespassed hmhm:
#your code
#return
Answer all the questions
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
