python问题求助大神,急急急!!!
classWater:defini(self):self.temperator=15self.level="凉水"defhotup(self):self.temperat...
class Water:
def ini(self):
self.temperator=15
self.level="凉水"
def hotup(self):
self.temperator+=10
self.setlevel
def setlevel(self):
if str(self.temperator<=10)and str(self.temperator>=0) :
self.level ="冰水"
elif (self.temperator<=20) and (self.temperator>10) :
self.level ="凉水"
else:
self.level ="好水"
def printl(self):
print(self.level,str(self.temperator))
w=Water
w.hotup
w.printl
为什么运行后什么都没有打印出来? 展开
def ini(self):
self.temperator=15
self.level="凉水"
def hotup(self):
self.temperator+=10
self.setlevel
def setlevel(self):
if str(self.temperator<=10)and str(self.temperator>=0) :
self.level ="冰水"
elif (self.temperator<=20) and (self.temperator>10) :
self.level ="凉水"
else:
self.level ="好水"
def printl(self):
print(self.level,str(self.temperator))
w=Water
w.hotup
w.printl
为什么运行后什么都没有打印出来? 展开
1个回答
展开全部
#coding:utf8
class Water():
def __init__(self):
self.temperator=15
self.level="凉水"
def hotup(self):
self.temperator+=10
self.setlevel()
def setlevel(self):
if str(self.temperator<=10)and str(self.temperator>=0) :
self.level ="冰水"
elif (self.temperator<=20) and (self.temperator>10) :
self.level ="凉水"
else:
self.level ="好水"
def printl(self):
print self.level,str(self.temperator)
w=Water()
w.printl()
追问
。
追答
#coding:utf8
class Water():
def __init__(self):
self.temperator=15
self.level="凉水"
def hotup(self):
self.temperator+=10
self.setlevel()
def setlevel(self):
if self.temperator<=10and self.temperator>=0 :
self.level ="冰水"
elif self.temperator<=20 and self.temperator>10 :
self.level ="凉水"
else:
self.level ="好水"
def printl(self):
print self.level,str(self.temperator)
w=Water()
w.printl()
w.hotup()
w.printl()
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询