Advertisement
Guest User

Untitled

a guest
Jan 18th, 2020
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.50 KB | None | 0 0
  1. from math import pi
  2. from math import pow
  3. type = input()
  4. area = 0
  5. #
  6. if type == "square":
  7. side_a = float(input())
  8. area = side_a * side_a
  9. #
  10. elif type == "rectangle":
  11. side_a = float(input())
  12. side_b = float(input())
  13. area = side_a * side_b
  14. #
  15. elif type == "circle":
  16. radius = float(input())
  17. area = 3.14 * pow(radius, 2)
  18. #
  19. elif type == "triangle":
  20. side_a = float(input())
  21. height = float(input())
  22. area = (side_a * height) / 2
  23. #
  24. print(f'{area:.3f}')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement