[英]Getting an unresolved reference and I'm not sure why [python]
def positive_reenforcement ():
emotion = input("How are you feeling today? happy/sad ")
if emotion == 'sad':
sad1 = input("What kind of saddness are you feeling? depression/hopelessness/really sad ")
if sad1 == 'depression':
depression()
elif sad1 == 'hopelessness':
hopelessness()
elif sad1 == 'really sad':
really_sad()
elif emotion == 'happy':
happy1 == input("What kind of happiness are you feeling? joy/giddyness/just happy")
if happy1 == 'joy':
joy()
elif happy1 == 'giddyness':
giddyness()
elif happy1 == 'just happy':
just_happy()
这是我的代码。 我得到它的变量happy1,但一切都为sad1工作。 我不知道为什么。
这是一个错字问题。
您不能使用(==)将数据分配给变量
更改此行。
happy1 == input("What kind of happiness are you feeling? joy/giddyness/just happy ")
对此
happy1 = input("What kind of happiness are you feeling? joy/giddyness/just happy ")
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.