Advertisement
aneliabogeva

Area of Figures

Apr 15th, 2019
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.47 KB | None | 0 0
  1. import math
  2.  
  3. figure = input()
  4.  
  5. if figure == "square":
  6. a = float(input())
  7. area = a * a
  8. print(f"{area:.3f}")
  9. elif figure == "rectangle":
  10. b = float(input())
  11. hb = float(input())
  12. area2 = b*hb
  13. print(f"{area2:.3f}")
  14. elif figure == "circle":
  15. r = float(input())
  16. area3 = math.pi * r**2
  17. print(f"{area3:.3f}")
  18. elif figure == "triangle":
  19. m = float(input())
  20. n = float(input())
  21. area4 = (m * n)/2
  22. print(f"{area4:.3f}")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement