class shape: def __init__ (self, x, y): self.x = x self.y = y description = "This is not described yet." author = "no one has made this shape yet" def area(self): return self.x * self.y def perimeter(self): return 2*self.x + 2*self.y def describe(self, text): self.description = text def authorName(self, text): self.author = text def scaleSize(self, scale): self.x = self.x*scale self.y = self.y*scale rectangle = shape(100, 45) print rectangle.area()
Run
Reset
Share
Import
Link
Embed
Language▼
English
中文
Python Fiddle
Python Cloud IDE
Follow @python_fiddle
Browser Version Not Supported
Due to Python Fiddle's reliance on advanced JavaScript techniques, older browsers might have problems running it correctly. Please download the latest version of your favourite browser.
Chrome 10+
Firefox 4+
Safari 5+
IE 10+
Let me try anyway!
url:
Go
Python Snippet
Stackoverflow Question