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
(5 pts) Write a function called ab val () that returns the absolute value of a number. Do not
use the built-in absolute value function from the math library.
Signature:
def ab_val (x) :
#your code
return abval(5)5
abval(-3.55)3.55
(4 pts) Write a function called circ_calc () 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 =3.14159.
'c'- circumference (2)
'a'- area using (r2)
,v'- volume of a sphere (43)(r3)
If the measure parameter is not any of these, return-1.
Signature:
def circ_calc(radius, shape):
#your code
return
(5 pts) Write a function called kind_of_roots () that describes the roots of a quadratic
function from the coefficients a,b, and c.
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 kind_of_roots(a, b, c):
#your code
return
(7 pts) Write a function called stock_advice () 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 30%.
The advice is "SELL" when the stock is down more than 50%.
For a stock that isn't changing very much (up more than 30 or down less than 50%), the
response should be "HOLD".
Signature:
def stock_advice(start_price, end_price):
#your code
return (250.09,466.75)
(8 pts) Write a function called level_up () 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
level-up.
Signature:
def level_up (points, level):
#your code
return (435,2)(555,8)
(5 pts) Write a function called level_up2() 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 level-up.
'intermediate': needs more than 200 times the next level's number to level up.
'expert' : needs more than 500 times the next level's number to level-up.
'pro': needs moge than a thousand times the next level's number to level up.
Signature:
def level_up2(points, level, expert_level):
#your code
return
(10 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 minutes_passed (h1,m1,h2,m2):
#your code
#return (9,15,11,45)150(10,59,12,11)=>72(4,38,2,2)
Answer all the questions
Do not use any functions or statements that have

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!