def bet(sport,home,away,market,selection,odds,stake,profit,bookie,tipster=None):
global df
if profit > 0:
is_won = True
elif profit < 0:
is_won = False
elif profit == 0:
None
temp_df = pd.DataFrame([[sport,home,away,market,selection,odds,tipster,stake,is_won,profit,bookie]], columns=columns_list)
df = df.append(temp_df, ignore_index=True)
if profit > 0:
print("Good bet on %s! :)" %selection)
elif profit < 0:
if tipster is not None:
print("Don't trust %s! :(" %tipster)
elif tipster is None:
print("Shame...")
elif profit == 0:
print("Cowboys")
返回UnboundLocalError:赋值前引用了局部变量'is\u won'
问题是当
profit == 0
。在这种情况下,将不定义is_won
。而且,你的压痕也弄乱了。你知道吗相关问题 更多 >
编程相关推荐