Advertisement
desislava_topuzakova

07. Area of Figures

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