0

Write a program that converts from cartesian to polar coordinates

Program should take two real numbers x and y that are between 0 and 1 and print the polar coordinates r and 0.

27th Sep 2016, 8:56 AM
We dem boyz
We dem boyz - avatar
1 Réponse
+ 2
Feel free to modify the precision: https://code.sololearn.com/cMI29soSqRNP import math def printPolar(x, y): r = math.sqrt(x*x + y*y) theta = math.atan(y/x) print("(" + str(round(r*100)/100) + ", " + str(round(theta*100)/100) + ")")
27th Sep 2016, 9:25 AM
Zen
Zen - avatar