mirror of
https://github.com/TheAlgorithms/Python.git
synced 2024-12-18 09:10:16 +00:00
897f1d0fb4
* Improved Formatting and Style
I improved formatting and style to make PyLama happier.
Linters used:
- mccabe
- pep257
- pydocstyle
- pep8
- pycodestyle
- pyflakes
- pylint
- isort
* Create volume.py
This script calculates the volumes of various shapes.
* Delete lucasSeries.py
* Revert "Delete lucasSeries.py"
This reverts commit 64c19f7a6c
.
* Update lucasSeries.py
26 lines
589 B
Python
26 lines
589 B
Python
"""
|
|
Greater Common Divisor.
|
|
|
|
Wikipedia reference: https://en.wikipedia.org/wiki/Greatest_common_divisor
|
|
"""
|
|
|
|
|
|
def gcd(a, b):
|
|
"""Calculate Greater Common Divisor (GCD)."""
|
|
return b if a == 0 else gcd(b % a, a)
|
|
|
|
|
|
def main():
|
|
"""Call GCD Function."""
|
|
try:
|
|
nums = input("Enter two Integers separated by comma (,): ").split(',')
|
|
num_1 = int(nums[0])
|
|
num_2 = int(nums[1])
|
|
except (IndexError, UnboundLocalError, ValueError):
|
|
print("Wrong Input")
|
|
print(f"gcd({num_1}, {num_2}) = {gcd(num_1, num_2)}")
|
|
|
|
|
|
if __name__ == '__main__':
|
|
main()
|