1
여기 그리고 내가 오류를 얻을 내 두 번째 계산에 도착잘못된 계산
# Calculate time it takes projectile to reach its target
def calcTime(distance,velocity,radians):
time = distance/(velocity * math.cos(radians))
return time
finaltime = calcTime(distance,velocity,radians)
잘 작동 처음으로 계산 한 것입니다. 내가 어디로 잘못 가고 있니? 나는 위의 32.17에 일정한 세트로 중력을하고 난 오류가 계속 'builtin_function_or_method'내가 플로트 (finaltime)를 변경하는 것을 시도했다
# Calculate the distance the projectile is off the ground at the targets distance
def calcHeight(velocity,finaltime,radians,const_gravity):
height = velocity * finaltime * (math.sin * radians) - ((const_gravity * finaltime**2)/2)
return height
finalheight = calcHeight(velocity,finaltime,radians,const_gravity)
'부동'와 *에 대한 지원되지 않는 피연산자 유형 (들) float (finalheight)하지만 둘 다 올바르지 않습니다. 근본적으로 나는 [finalheight] 변수를 출력하려고합니다.
때로는 계산이 항상 정확하지 않아 특정 계산을 수행 할 때 괄호를 사용하지만 때때로 math.sin (라디안) –