Polar Coordinates

  • + 0 comments
    # The solution is very straightforward, given the problem explanation. The input is directly converted into a complex number, then abs() and phase() are executed on that complex number, giving polar coordinates r and phi respectively.
    from cmath import phase
    
    z = complex(input())
    print(abs(z))
    print(phase(z))