if a%b==0:return b return gcd(b,a%b)def lcm(a,b):return a//gcd(a,b)*b a=random.randint(1,100)b=random.randint(1,100)c=random.randint(1,100)print(a,b,c,gcd(gcd(a,b),c),lcm(lcm(a,b),c))
1. filter 1.1 把一个序列中的空字符串删掉 例如将[‘A’, ‘’, ‘B’, None, ‘C’, ’ ']返回为[‘A’, ‘B’, ‘C’] def not_empty(s): return s and s.strip() list(filter(not_empty, ['A', '', 'B', None, 'C', ' '])) 1. 2. 3. 4. 可见用filter()这个高阶函数...