Polar Coordinates - Solution Python

Polar Coordinates - Solution Python

Instructor-svgAl-Mamun Sarkar
Mar 26 , 2020

Polar Coordinates problem solution in Python. The following code is the solution of the HackerRank Polar Coordinates Python Math problem.

Code:

import cmath

input = complex( input() )

print( abs(input) )
print( cmath.phase(input) )

 

Test Input:

  1+2j

Test Output:

 2.23606797749979 
 1.1071487177940904

 

  • Share On:
  • fb
  • twitter
  • pinterest
  • instagram