Advertisement
gen4i4

Untitled

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