My issue
Assign side length of square
s = 10
Assign length and breadth of rectangle
l = 25
b = 17
Calculate areas of square and rectangle
areas = s * s
arear = l * b
Calculate difference in area between rectangle and square
areadiff = arear - areas
Cost of painting the square
costs = areas * 4 # Rs. 4 per cm^2
Print the results
print(“Area of the square:”, areas)
print(“Area of the rectangle:”, arear)
print(“Difference in area:”, areadiff)
print(“Cost of painting the square:”, costs)
My code
# Assign side length of square
s = 10
# Assign length and breadth of rectangle
l = 25
b = 17
# Calculate areas of square and rectangle
areas = s * s
arear = l * b
# Calculate difference in area between rectangle and square
areadiff = arear - areas
# Cost of painting the square
costs = areas * 4 # Rs. 4 per cm^2
# Print the results
print("Area of the square:", areas)
print("Area of the rectangle:", arear)
print("Difference in area:", areadiff)
print("Cost of painting the square:", costs)
Learning course: Learn Python
Problem Link: Arithmetic Operations With Variables Practice Problem in Python - CodeChef