Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
如果您在 python 中有一个整数列表,例如L = [4,8,12,24],您如何计算它们的最大公分母/除数(在这种情况下为 4)?
L = [4,8,12,24]
一种方法是:
import fractions def gcd(L): return reduce(fractions.gcd, L) print gcd([4,8,12,24])