-3
我剛開始自學Python,對於我正在開發的項目。 這可能是一個相當新人的問題,但是您可以使用打印功能的次數有限制嗎?我的代碼使用Print來請求來自用戶的輸入,但是在第六個實例中出現語法錯誤(無效語法)。據我所知,在線附近沒有錯誤。 我正在使用Python 3.4.4。使用多個打印功能後的Python語法錯誤
問題是:
print('What is the isentropic efficiency of the intake?')
整個從代碼中發揮的是;
# Define cycle
print('What is the cruise altitude (m)?')
altitude = float(input())
print('What is the cruise Mach number?')
print('What is the mass flow?')
W = float(input())
mach0 = float(input())
print('What is the OPR?')
OPR = float(input())
print('What is the TET?')
TET = float(input())
gamma = 1.4
Cp = 1000
# Calculate the freestream properties based on ISA
if altitude < 11000:
t0 = 288.15 - (6.5*(altitude/1000))
p0 = 101325*((1-(0.0065*(altitude/288.15)))**5.2561)
else:
t0 = 288.15 - (6.5*11)
p0 = (101325*((1-(0.0065*(11000/288.15)))**5.2561))*math.exp((-9.80665*(altitude-11000))/(287.04*t0))
# Calculate Intake Performance
T0 = t0*(1+(((gamma-1)/2)*(mach0**2)))
P0 = p0*((T0/t0)**(gamma/(gamma-1))
print('What is the isentropic efficiency of the intake?')
eta_intake = float(input())
T2 = T0*(1+(((gamma-1)/2)*eta_intake*(mach0**2)))
P2 = P0*((T2/T0)**(gamma/(gamma-1))
你可能想要使用一個可以與你的圓括號匹配的編輯器。 – chepner