我创建了一个字典,里面有速度、温度和高度的值:
mach_dict = dict(velocity=[], altitude=[], temperature=[])
我用它来存储爬升、巡航和下降段飞行平原的值。你知道吗
mach_dict = {'velocity': [0, 300, 495, 500, 300], 'altitude': [288.15, 288.15, 288.15, 288.15, 288.15], 'temperature': [0, 0, 50, 50, 50]}
我需要创建一个函数(def),它返回一个字典,其中存储每个段的马赫数。你知道吗
要估计Mach
,我使用以下公式:
Mach = velocity / sqrt(1.4 * 286 * (Temperature - altitude * 0.05))
有人能帮忙吗?你知道吗
您可以将3个列表压缩到一起以生成
velocity, altitude, temperature
元组:不幸的是,您的输入会导致
ValueError: math domain error
,因为对于某些情况,您会得到1.4 * 286 * (temp - alt * 0.05)
的负值。你知道吗您可以
zip
字典中的列表值,并使用列表理解计算新键mach_number
:从技术上讲,这是在修改传入的字典,而
return
是不必要的。你知道吗相关问题 更多 >
编程相关推荐