我正在编写一个计算物体移动距离的程序,但是当我运行该程序时,使用45作为角度(sin45和cos45是等效的),输出的垂直高度和水平高度不同
import math
angle = float(input("Enter Angle of Movement(In Degrees): "))
print("Angle is: ",angle,"°")
horizontal_distance = (abs(overall_distance*math.sin(90-angle)))
print("Horizontal Distance:",horizontal_distance,"m")
vertical_distance = (abs(overall_distance*math.cos(90-angle)))
print("Vertical Distance:",vertical_distance,"m")发布于 2020-11-02 03:05:54
对于第二个问题
import math
x = math.radians(float(input()))
y = math.radians(float(input()))
SIN = math.sin(x)
COS = math.cos(y)
print(x)
print(y)
print(SIN)
print(COS)
45 
45
0.7853981633974483
0.7853981633974483
0.7071067811865476
0.7071067811865476https://stackoverflow.com/questions/64635695
复制相似问题