# First Exercises

# Find the area of a rectangle

img

OUTPUT

w: 6 h: 9 area of this rectangle: 54.0

Solution
w = float(input("w: "))
h = float(input("h: "))
answer = f"area of this rectangle: {w*h}"
print(answer)
1
2
3
4

# Find the area of a rectangle

img

OUTPUT

w: 6 h: 9 area of this rectangle: 27.0

Solution
w = float(input("w: "))
h = float(input("h: "))
print(f"area of this rectangle: {w*h/2}")
1
2
3

# Find mean average of 3 values

OUTPUT

a: 150 b: 20 c: 1 57.0

OUTPUT

a: 9 b: 9 c: 0 6.0

Solution
a = float(input("a: "))
b = float(input("b: "))
c = float(input("c: "))
print((a+b+c)/3)
1
2
3
4

# Find discounted price!

OUTPUT

Enter normal price: 900 Enter discount: 20 Discounted price: 720.0

OUTPUT

Enter normal price: 500 Enter discount: 40 Discounted price: 300.0

Solution
normal_price=float(input("Enter normal price: "))
discount=float(input("Enter discount: "))

discount_price= normal_price-(discount/100*normal_price)
print(f"Discounted price: {discount_price}")
1
2
3
4
5