Python-Spyder:语法无效-为什么?

我的语法无效:

Upper_stress=10 #Upper stress limit
Lower_stress=0 #Lower stress limiy
Number_tests =[]
Normalized_stress=[]
NumberstressLevels = [] #of stress levels for each component
base  = [0.5,0.5,0.5] #True Value: Theta_0,theta_1 and Sigma
Time_Scale =(np.exp(base[0]+base[1]*0.25)  #Generate failure time with scale = exp(alpha)
Time_Shape =(1/base[2]) #Generate failure time with shape =1/sigma


  Time_Shape = 1/base[2]#Generate failure time with (shape =1/sigma)
             ^
SyntaxError: invalid syntax

如果我删除导致错误的行,则无效的suntax移至下一行:

s_0=[1,1]

工作正常,突然开始提供无效的语法。我不明白为什么!

xhf5211314 回答:Python-Spyder:语法无效-为什么?

在这里您错过了括号。

Time_Scale =(np.exp(base[0]+base[1]*0.25)) # <=== here

但是您应该这样写:

Time_Scale = np.exp(base[0]+base[1]*0.25)

无需括号

本文链接:https://www.f2er.com/3150965.html

大家都在问