288 B
288 B
title, tags
| title | tags |
|---|---|
| gcd | math,beginner |
Calculates the greatest common divisor of a list of numbers.
Use reduce() and math.gcd over the given list.
from functools import reduce
import math
def gcd(numbers):
return reduce(math.gcd, numbers)
gcd([8,36,28]) # 4