2 回答
TA贡献1877条经验 获得超1个赞
只需将代码放入循环中:
while True:
if remove_char1_attr1 = 'yes':
char1_attr1.remove(min(char1_attr1))
char1_attr1_5 = random.randint(1,6)
char1_attr1.append(char1_attr1_5)
print("The numbers are now as follows: " +char1_attr1 )
elif remove_char1_attr1 = 'no'
break
else:
#incorrect_response()
print("Incorrect")
然后它将运行直到“否”remove_char1_attr1
TA贡献1810条经验 获得超5个赞
您可以尝试循环,而它不是是或否
while remove_char1_attr1 not in ('yes', 'no'):
if remove_char1_attr1 = 'yes':
char1_attr1.remove(min(char1_attr1))
char1_attr1_5 = random.randint(1,6)
char1_attr1.append(char1_attr1_5)
print("The numbers are now as follows: " +char1_attr1 )
elif remove_char1_attr1 = 'no'
break
else:
incorrect_response()
添加回答
举报