Open this example in the interactive library
Source code
from math import gcd
print(gcd(48, 18))Sample output
6

Compute greatest common divisor. A self-contained example using the Python standard library.
Open this example in the interactive library
from math import gcd
print(gcd(48, 18))6