from math import * def rect_to_polar(x, y): magnitude = sqrt (x*x + y * y) angle = atan2(x, y) return magnitude, angle