Ddimov90

area_of_firgures_06_01

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