MCPcopy Create free account
hub / github.com/subbarayudu-j/TheAlgorithms-Python / absVal

Function absVal

Maths/abs.py:1–12  ·  view source on GitHub ↗

Function to fins absolute value of numbers. >>absVal(-5) 5 >>absVal(0) 0

(num)

Source from the content-addressed store, hash-verified

1def absVal(num):
2 """
3 Function to fins absolute value of numbers.
4 >>absVal(-5)
5 5
6 >>absVal(0)
7 0
8 """
9 if num < 0:
10 return -num
11 else:
12 return num
13
14def main():
15 print(absVal(-34)) # = 34

Callers 2

absMinFunction · 0.90
mainFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected