本帖最后由 拨Q 于 2021-1-22 11:01 编辑
[Python] 纯文本查看 复制代码 # 1111
import random
class Eat:
def __init__(self,a,b,c,e,f):
foods = [self.a,self.b,self.c,self.e,self.f]
def judge(self):
print('今晚吃什么?面条,米饭,屎,麻辣烫,汤圆')
want = input('输入你想吃的:')
if want in foods:
print('好,就决定是%s了' %want)
else:
print('只有这些东西哦,那我帮你选吧')
while True:
robot_choice = random.choice(self.foods)
# print('那我们吃%s好吗?' %robot_choice)
Agree = input('那你吃%s好吗?' %robot_choice)
if Agree == '好':
print('就这样决定了,吃%s' %robot_choice)
break
a1 = Eat('面条','米饭','屎','麻辣烫','汤圆')
a1.judge()
Python求助,22行和第6行咋错了,想了好久,网上也没有答案 |