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_level
print mydog.cooked_string
print mydog.condiments
print " now i'm going to cook the hotdog"
mydog.cook(4)
print mydog.cooked_level
print mydog.cooked_string
以下是输出
0
raw
[]
now i'm going to cook the hotdog
4
raw这里为什么还是raw啊
看教程上输出应该是menium
我除了大小写其他的完全抄的教程
慕粉1628552447
孤独的小猪
随时随地看视频慕课网APP
相关分类