Skip to content

Commit f0568d6

Browse files
realDuYuanChaocclauss
authored andcommitted
less code (TheAlgorithms#1292)
1 parent 0da4d0a commit f0568d6

File tree

1 file changed

+1
-5
lines changed

1 file changed

+1
-5
lines changed

maths/abs.py

+1-5
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,7 @@ def abs_val(num):
1010
>>abs_val(0)
1111
0
1212
"""
13-
if num < 0:
14-
return -num
15-
16-
# Returns if number is not < 0
17-
return num
13+
return -num if num < 0 else num
1814

1915

2016
def main():

0 commit comments

Comments
 (0)