Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import math
- figure_type = input()
- area = 0
- if figure_type == "square":
- side = float(input())
- area = side * side
- elif figure_type == "rectangle":
- a = float(input())
- b = float(input())
- area = a * b
- elif figure_type == "circle":
- r = float(input())
- area = math.pi * r ** 2
- elif figure_type == "triangle":
- c = float(input())
- h = float(input())
- area = (c * h) / 2
- print(f"{area:.3f}")
Advertisement
Add Comment
Please, Sign In to add comment