GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — StarterLearningPython/python3code/chapter04/gcdlcm.py at master · oldthreefeng/StarterLearningPython Expand file tree/ Copy pathgcdlcm.pyMore file actions 19 lines (16 loc) · 347 Bytes / Copy pathgcdlcm.pyFile metadata and controls19 lines (16 loc) · 347 Bytes 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 #coding:utf-8 ''' filename: gcdlcm.py ''' def gcd(a, b): #最大公约数 if not a > b: a, b = b, a while b != 0: remainder = a % b a, b = b, remainder return a def lcm(a, b): #最小公倍数 return (a * b) / gcd(a,b) if __name__ == "__main__": print(gcd(8, 20)) print(lcm(8, 20)) |
| You are visitor 01402775 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |