Input Format
A single line containing the complex number . Note: complex() function can be used in python to convert the input as a complex number.
Constraints
Given number is a valid complex number
Output Format
Output two lines:
The first line should contain the value of .
The second line should contain the value of .

hackerrank polar coordinates problem solution in python programming

Problem solution in python 2 programming language.

from cmath import polar
polar = polar(complex(raw_input()))
print polar[0]
print polar[1]

Problem solution in python 3 programming language.

from cmath import polar
polar = polar(complex(input()))
print(polar[0])
print(polar[1])

Second solution

# Enter your code here. Read input from STDIN. Print output to STDOUT
import cmath
print(*cmath.polar(complex(input())), sep='\n')