Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # 1. Read figure type
- import math
- figure_type = input()
- # 2. Check if:
- # a: square -> read "a" // calc
- # b: rectangle -> read width and length // calc
- # c: circle -> read radius
- # d: triangle -> read "a" and ha
- a = float(input())
- area = 0
- if figure_type == "square":
- area = a * a
- elif figure_type == "rectangle":
- b = float(input())
- area = a * b
- elif figure_type == "circle":
- # pi * r * r
- area = math.pi * math.pow(a, 2)
- elif figure_type == "triangle":
- height = float(input())
- area = a * height / 2
- print("%.2f" % area)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement