#import the cmath module
import cmath

print(cmath.polar(2 + 5j))

The cmath.polar() function converts a complex number to polar coordinates. It returns a tuple of modulus and phase values.

The magnitude of the complex number is the square root of the sum of the squares of the real and imaginary parts. The angle is the angle in radians with the x-axis, counter-clockwise positive.

cmath.polar(x)
x The value(real or complex) to find polar coordinate of. If the argument is a real number, it is first converted into a complex number before the operation.

The function returns  a complex number representing the polar coordinates of the input complex number, x.

#import the cmath module
import cmath

#print polar coordinates of some values
print(cmath.polar(1))
print(cmath.polar(3))
print(cmath.polar(1 + 2j))
print(cmath.polar(3 + 4j))
print(cmath.polar(-5 + 2j))