Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #1. вид на фигура: квадрат (square), правоъгълник (rectangle), кръг (circle) и триъгълник (triangle)
- import math
- type = input()
- if type == "square":
- square_side = float(input())
- square_area = math.pow(square_side, 2)
- print(f"{square_area:.3f}")
- elif type == "rectangle":
- width = float(input())
- length = float(input())
- rectangle_area = width * length
- print(f"{rectangle_area:.3f}")
- elif type == "circle":
- r = float(input())
- circle_area = math.pi * math.pow(r, 2)
- print(f"{circle_area:.3f}")
- elif type == "triangle":
- triangle_side = float(input())
- h = float(input())
- triangle_area = triangle_side * h / 2
- print(f"{triangle_area:.3f}")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement