当一个人有正确答案时,我试图增加价值
I am trying to add a value , when a person have the right answer
我正尝试在 Python 中为 Otree 应用编写代码。
主要想法是,当某人的答案与我输入常量的答案相同时,固定付款增加 20 美元。
例如,在这段代码中,我在 Constants.retemv 中的值为 3 如果某人在 J11 表单中输入 3 的响应,则将获得 $20
我尝试使用下一个代码,付款是一个常数,价值 20 美元。
def set_payoff(self):
self.payoff = Constants.participation_fee + Constants.iat
if self.J11 == Constants.retemv:
self.payoff += Constants.payment
当人们给出与我的 retemv 相同的答案时,我希望输出 45 美元”
这可能是您要查找的内容:
def set_payoff(self):
if self.J11 == Constants.retemv:
self.payoff = Constants.participation_fee + Constants.iat + Constants.payment
else:
self.payoff = Constants.participation_fee + Constants.iat
我正尝试在 Python 中为 Otree 应用编写代码。
主要想法是,当某人的答案与我输入常量的答案相同时,固定付款增加 20 美元。
例如,在这段代码中,我在 Constants.retemv 中的值为 3 如果某人在 J11 表单中输入 3 的响应,则将获得 $20
我尝试使用下一个代码,付款是一个常数,价值 20 美元。
def set_payoff(self):
self.payoff = Constants.participation_fee + Constants.iat
if self.J11 == Constants.retemv:
self.payoff += Constants.payment
当人们给出与我的 retemv 相同的答案时,我希望输出 45 美元”
这可能是您要查找的内容:
def set_payoff(self):
if self.J11 == Constants.retemv:
self.payoff = Constants.participation_fee + Constants.iat + Constants.payment
else:
self.payoff = Constants.participation_fee + Constants.iat