this constructor takes no arguments错误提示 内容: #!python class Rectangle 求学习求指导
#!pythonclassRectangle:def_init_(self,width=0,height=0,color='black',emphasis=None,hi...
#!python
class Rectangle:
def _init_(self,width=0,height=0,color='black',emphasis=None,highlight=0):
self.width=width
self.height=height
self.color=color
self.emphasis=emphasis
self.highlight=highlight
def pandun(self):
if width==o and height==0 and color=='red' and emphasis=='strong' or highlight>100:
raise ValueError,'sorry,you lose'
if width==0 and height==0 and (color=='red' or
emphasis is None):
raise ValueError,'i dont think so'
def printdongxi(self):
return self.width
c=Rectangle(0,0,'red','strong',0) 展开
class Rectangle:
def _init_(self,width=0,height=0,color='black',emphasis=None,highlight=0):
self.width=width
self.height=height
self.color=color
self.emphasis=emphasis
self.highlight=highlight
def pandun(self):
if width==o and height==0 and color=='red' and emphasis=='strong' or highlight>100:
raise ValueError,'sorry,you lose'
if width==0 and height==0 and (color=='red' or
emphasis is None):
raise ValueError,'i dont think so'
def printdongxi(self):
return self.width
c=Rectangle(0,0,'red','strong',0) 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询