2016-05-29 52 views
-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)) 
+1

你可能想要使用一个可以与你的圆括号匹配的编辑器。 – chepner

回答

0

不,您可以在Python中使用任何函数的次数没有限制。该错误不是由print语句的行引起的。
上一行缺少右括号。它应该是这样的:

P0 = p0*((T0/t0)**(gamma/(gamma-1))) 

print('What is the isentropic efficiency of the intake?')