class hotdog: def __init__(self): self.cooked_level = 0 self.cooked_string = "raw" self.condiments = [] def cook(self ,time): self.cooked_level = self.cooked_level + time if self.cooked_level > 8: self.cooked_setring = "charcoal" elif self.cooked_level > 5: self.cooked_string = "welldone" elif self.cooked_level > 3: self.cooken_string = "menium" else: self.cooked_string = "raw"mydog = hotdog()print mydog.cooked_levelprint mydog.cooked_stringprint mydog.condimentsprint " now i'm going to cook the hotdog"mydog.cook(4)print mydog.cooked_levelprint mydog.cooked_string以下是输出0raw[] now i'm going to cook the hotdog4raw这里为什么还是raw啊看教程上输出应该是menium我除了大小写其他的完全抄的教程
添加回答
举报
0/150
提交
取消


