#!/usr/bin/python3 # -*- coding: utf-8 -*- """ Greatest Common Divisor using Euclid's Algorithm """ # %% GCD loop def gcd_loop(a: int, b: int) -> int: """ Return the Greatest Common Divisor of a and b using Euclid's Algorithm """ while a != 0: a, b = b % a, a return b print(gcd_loop(10, 15)) # %% CGD recursive def gcd_rec(a: int, b: int) -> int: """ Return the Greatest Common Divisor of a and b using Euclid's Algorithm """ if b == 0: return a else: return gcd_rec(b, a % b) print(gcd_rec(10, 15))