Advertisement
dkyoseff

Conditional Statements - Lab / 07. Area of Figures

Jul 7th, 2022
907
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.47 KB | None | 0 0
  1. import math
  2.  
  3. figure = str(input())
  4.  
  5. if figure == ('square'):
  6.     size = float(input())
  7.     print(f"{size * size:.3f}")
  8.  
  9. elif figure == ('rectangle'):
  10.     lenght = float(input())
  11.     width = float(input())
  12.     print(f"{lenght * width:.3f}")
  13.  
  14. elif figure == ('circle'):
  15.     radius = float(input())
  16.     print(f"{(radius * radius) * math.pi:.3f}")
  17.  
  18. elif figure == ('triangle'):
  19.     base = float(input())
  20.     height= float(input())
  21.     print(f"{(height * base) / 2:.3f}")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement