Skip to content

Commit

Permalink
less code (TheAlgorithms#1292)
Browse files Browse the repository at this point in the history
  • Loading branch information
realDuYuanChao authored and cclauss committed Oct 8, 2019
1 parent 0da4d0a commit f0568d6
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions maths/abs.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,7 @@ def abs_val(num):
>>abs_val(0)
0
"""
if num < 0:
return -num

# Returns if number is not < 0
return num
return -num if num < 0 else num


def main():
Expand Down

0 comments on commit f0568d6

Please sign in to comment.