Polar Coordinates

Sort by

recency

|

482 Discussions

|

  • + 0 comments

    Here is HackerRank Polar Coordinates in python solution - https://programmingoneonone.com/hackerrank-polar-coordinates-solution-in-python.html

  • + 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))
    
  • + 0 comments

    from cmath import phase

    z = complex(input())

    print(round(abs((z)), 3))

    print(round(phase((z)), 3))

  • + 0 comments
    from cmath import phase 
    z=input().strip()
    print(abs(complex(z)))
    print(phase(complex(z)))
    
  • + 0 comments
    import cmath
    z = complex(input())
    r = abs(z)
    phi = cmath.phase(z)
    print(r)
    print(phi)