HOME/Articles/

python code find gcd (snippet)

Article Outline

Python example 'python code find gcd'

Functions in program:

  • def gcd(numbers):

Modules used in program:

  • import math

python code find gcd

Python code example: python code find gcd

# Find gcd of a list of numbers

from functools import reduce
import math
def gcd(numbers):
    return reduce(math.gcd, numbers)
gcd([24,108,90])

More Python: https://pythonprogramminglanguage.com