fork(2) download
  1. # your code goes here
  2. import math
  3.  
  4. r = 5 # radius
  5.  
  6. circ_a = math.pi*r**2 # area of a circle
  7. print circ_a
  8.  
  9. # Area of a rectangle
  10.  
  11. length = 12
  12. width = 21
  13. rect_a = length*width
  14.  
  15. print "Area of the rectangle is ", rect_a
  16.  
  17. # Area of a triangle
  18.  
  19. base = 3
  20. height = 5
  21. tri_a = base*height/2.0
  22.  
  23. print "Area of the triangle is %f and the area of the circle is %f" % (
  24. tri_a, circ_a)
  25.  
  26. # Area of a square
  27.  
  28. print "Enter the length of the square's side: "
  29. side = float(raw_input())
  30.  
  31. square_a = side**2
  32. print "The area of your square is %f" % square_a
  33.  
Success #stdin #stdout 0.01s 7696KB
stdin
1.5
stdout
78.5398163397
Area of the rectangle is  252
Area of the triangle is 7.500000 and the area of the circle is 78.539816
Enter the length of the square's side: 
The area of your square is 2.250000