mirror of
https://github.com/TheAlgorithms/Python.git
synced 2024-11-23 21:11:08 +00:00
bd4017928e
* 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.
26 lines
518 B
Python
26 lines
518 B
Python
"""Find Least Common Multiple."""
|
|
|
|
# https://en.wikipedia.org/wiki/Least_common_multiple
|
|
|
|
|
|
def find_lcm(num_1, num_2):
|
|
"""Find the LCM of two numbers."""
|
|
max = num_1 if num_1 > num_2 else num_2
|
|
lcm = max
|
|
while (True):
|
|
if ((lcm % num_1 == 0) and (lcm % num_2 == 0)):
|
|
break
|
|
lcm += max
|
|
return lcm
|
|
|
|
|
|
def main():
|
|
"""Use test numbers to run the find_lcm algorithm."""
|
|
num_1 = 12
|
|
num_2 = 76
|
|
print(find_lcm(num_1, num_2))
|
|
|
|
|
|
if __name__ == '__main__':
|
|
main()
|