0
点赞
收藏
分享

微信扫一扫

Python:实现newtons second law of motion牛顿第二运动定律算法(附完整源码)


Python:实现newtons second law of motion牛顿第二运动定律算法

def newtons_second_law_of_motion(mass: float, acceleration: float) -> float:

force = float()
try:
force = mass * acceleration
except Exception:
return -0.0
return force


if __name__ == "__main__":
import doctest

# run doctest
doctest.testmod()

# demo
mass = 12.5
acceleration = 10
force = newtons_second_law_of_motion(mass, acceleration)
print("The force is ", force, "N")


举报

相关推荐

0 条评论