# First Exercises
# Find the area of a rectangle
OUTPUT
w:
h:
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
2
3
4
# Find the area of a rectangle
OUTPUT
w:
h:
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
2
3
# Find mean average of 3 values
OUTPUT
a:
b:
c:
57.0
OUTPUT
a:
b:
c:
6.0
Solution
a = float(input("a: "))
b = float(input("b: "))
c = float(input("c: "))
print((a+b+c)/3)
1
2
3
4
2
3
4
# Find discounted price!
OUTPUT
Enter normal price:
Enter discount:
Discounted price: 720.0
OUTPUT
Enter normal price:
Enter discount:
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
2
3
4
5