from math import pi h = 5.0 # height b = 2.0 # base r = 1.5 # radius area_parallelogram = h*b print 'The area of the parallelogram is %.3f' % area_parallelogram area_square = b**2 print 'The area of the square is %g' % area_square area_circle = pi*r**2 print 'The area of the circle is %.3f' % area_circle volume_cone = 1.0/3*pi*r**2*h print 'The volume of the cone is %.3f' % volume_cone ''' Sample run: The area of the parallelogram is 10.000 The area of the square is 4 The area of the circle is 7.069 The volume of the cone is 11.781 '''
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