from math import * print("This program will display the surface area and volume represented in a solid cube. ") class Cube: def __init__(seflf, r): self.radius = radius self.surfaceArea = 0 self.volume = 0 def getRadius(self): r = self.radius self.area = 6 * r * r return (self.area) def getVolume(self): r = self.radius self.volume = r * r * r return (self.volume) def main(): r = input("Please ener the radius of the cube: ") c = Cubes(r) print("The volume of the cube is: ", c.surfaceArea()) print("The surface area pf the cube is: ", c.volume()) if __name__ == '__main__': main()
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