【发布时间】:2017-05-16 16:36:30
【问题描述】:
a 、 b 和 c 是预定义函数,它们是更大代码的一部分。 即使选择是enemy_def,代码也总是返回elif部分 我已经尝试打印每一个,但没有任何反应
a = enemy_hit
b = enemy_def
c = enemy_sphit
d = [a,b,c]
enemyresponse = random.choice(d)()
#print(enemyresponse)
if enemyresponse == b :
thing.health = thing.health - 0.25
#print(enemyresponse)
elif enemyresponse != b :
#print(enemyresponse)
thing.health = thing.health - 1
【问题讨论】:
标签: python-3.x function if-statement random choice