我似乎无法弄清楚这里发生了什么。当我编译时,我得到不匹配错误。
它给出了有关$result=unserialize("your serialized array which is in db");
bgB = 0;
所以在用@Downshift建议更新代码并添加一些elifs之后我得到了同样的东西
def calcBG(ftemp):
"This calculates the color value for the background"
variance = ftemp - justRight; # Calculate the variance
adj = calcColorAdj(variance); # Scale it to 8 bit int
bgList = [0,0,0] # initialize the color array
if(variance < 0):
bgR = 0; # too cold, no red bgB = adj; # green and blue slide equally with adj bgG = 255 - adj; elif(variance == 0): # perfect, all on green bgR = 0; bgB = 0; bgG = 255; elif(variance > 0): # too hot - no blue
bgB = 0;
bgR = adj; # red and green slide equally with Adj
bgG = 255 - adj;
另外:如果有人可以向我指出/向我解释我未能做到的事情,那将是伟大的。因为我似乎无法在第二部分找到我的问题。这与第一个问题相同。
答案 0 :(得分:0)
由于口译员告诉你压痕水平不一致。确保在第一行方法定义和if
语句后缩进,除了修改缩进之外没有对代码进行任何更改:
def calcBG(ftemp):
"""This calculates the color value for the background"""
variance = ftemp - justRight; # Calculate the variance
adj = calcColorAdj(variance); # Scale it to 8 bit int
bgList = [0,0,0] # initialize the color array
if(variance < 0):
bgR = 0; # too cold, no red bgB = adj; # green and blue slide equally with adj bgG = 255 - adj; elif(variance == 0): # perfect, all on green bgR = 0; bgB = 0; bgG = 255; elif(variance > 0): # too hot - no blue
bgB = 0;
bgR = adj; # red and green slide equally with Adj
bgG = 255 - adj;