Define python function called absolute that takes one parameter and return one absolute value of x ie:|x|=(x if >=0,-x otherwis | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
- 1

Define python function called absolute that takes one parameter and return one absolute value of x ie:|x|=(x if >=0,-x otherwis

17th Nov 2020, 8:18 PM
Prerna Keshkar
Prerna Keshkar - avatar
2 Answers
17th Nov 2020, 8:21 PM
Letsintegreat
Letsintegreat - avatar
0
def abs(num): if(num>=0): return num else: return -num
17th Nov 2020, 8:33 PM
Sousou
Sousou - avatar