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.
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) + ")")