Question: Write a function my_abs (value) that returns the absolute value of value, without using the built-in abs function in Python. You are required to

Write a function my_abs (value) that returns the absolute value of value, 

Write a function my_abs (value) that returns the absolute value of value, without using the built-in abs function in Python. You are required to use an if statement for this question. For example: Test print (my_abs (3.5)) 3.5 print (my_abs(-7)) 7 Result

Step by Step Solution

3.39 Rating (152 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

Heres an implementation of the myabs function that returns the absolute value of a given value witho... View full answer

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 Computer Engineering Questions!