mirror of
https://github.com/TheAlgorithms/Python.git
synced 2025-07-06 10:31:29 +08:00
Improve Formatting and Code Quality (#934)
* Improved Formatting of basic_maths.py - Added docstrings. - Improved whitespace formatting. - Renamed functions to match snake_case. * Improved Formatting of factorial_python.py - Added docstrings. - Improved whitespace formatting. - Renamed constants to match UPPER_CASE. * Improved Formatting of factorial_recursive.py - Improved whitespace formatting to meet PyLint standards. * Improved Code to Conform to PyLint - Renamed `max` to `max_num` to avoid redefining built-in 'max' [pylint] - Removed unnecessary parens after 'while' keyword [pylint] * Improved Formatting of factorial_recursive.py - Added docstrings. - Improved whitespace formatting.
This commit is contained in:

committed by
Anup Kumar Panwar

parent
bd4017928e
commit
a2236cfb97
@ -1,13 +1,14 @@
|
||||
def fact(n):
|
||||
"""
|
||||
Return 1, if n is 1 or below,
|
||||
otherwise, return n * fact(n-1).
|
||||
"""
|
||||
return 1 if n <= 1 else n * fact(n-1)
|
||||
"""
|
||||
Return 1, if n is 1 or below,
|
||||
otherwise, return n * fact(n-1).
|
||||
"""
|
||||
return 1 if n <= 1 else n * fact(n - 1)
|
||||
|
||||
|
||||
"""
|
||||
Shown factorial for i,
|
||||
Show factorial for i,
|
||||
where i ranges from 1 to 20.
|
||||
"""
|
||||
for i in range(1,21):
|
||||
print(i, ": ", fact(i), sep='')
|
||||
for i in range(1, 21):
|
||||
print(i, ": ", fact(i), sep='')
|
||||
|
Reference in New Issue
Block a user