mirror of
https://github.com/TheAlgorithms/Python.git
synced 2025-07-05 09:21:13 +08:00
Added Whitespace and Docstring (#924)
* Added Whitespace and Docstring I modified the file to make Pylint happier and make the code more readable. * Beautified Code and Added Docstring I modified the file to make Pylint happier and make the code more readable. * Added DOCSTRINGS, Wikipedia link, and whitespace I added DOCSTRINGS and whitespace to make the code more readable and understandable. * Improved Formatting * Wrapped comments * Fixed spelling error for `movement` variable * Added DOCSTRINGs * Improved Formatting * Corrected whitespace to improve readability. * Added docstrings. * Made comments fit inside an 80 column layout.
This commit is contained in:
11
maths/abs.py
11
maths/abs.py
@ -1,6 +1,10 @@
|
||||
"""Absolute Value."""
|
||||
|
||||
|
||||
def absVal(num):
|
||||
"""
|
||||
Function to fins absolute value of numbers.
|
||||
Find the absolute value of a number.
|
||||
|
||||
>>absVal(-5)
|
||||
5
|
||||
>>absVal(0)
|
||||
@ -11,8 +15,11 @@ def absVal(num):
|
||||
else:
|
||||
return num
|
||||
|
||||
|
||||
def main():
|
||||
print(absVal(-34)) # = 34
|
||||
"""Print absolute value of -34."""
|
||||
print(absVal(-34)) # = 34
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
|
Reference in New Issue
Block a user