Two points (cospi/3, sinpi/3) and (-exp(2), log(10)
I wrote the following code to find the distance.
import path
def distance (x1, y1, x2, y2):
return((x2-x1)**2+(y2-y1)**2)**0.5
print(((math.cos(math.pi/3)),(math.sin(math.pi/3)),(-math.exp(2)),(math.log(10)).
Then the error says "invalid synctax" and it doesn't print well.
When I displayed the four values using the path in print, it was calculated well, so I don't think it was a mistake in that part.
Could you please let me know where I need to correct the code to work well?
Thank you for your cooperation.
python
This may simply be because the last .
of each parameter is unnecessary and the last )
is missing.
It should work by doing the following:
print(distance((math.cos(math.pi/3)), (math.sin(math.pi/3)), (-math.exp(2), (math.log(10))))
© 2024 OneMinuteCode. All rights reserved.