Python Practice › Basic Programs › Program 15
Area of a square
Write a Python program to calculate the area of a square. Area = side × side.
Input
side = 6.5
Output
Area of the square: 42.25
Approach
- Multiply the side by itself.
Solution
side = 6.5area = side * sideprint("Area of the square:", area)Output
Area of the square: 42.25
Line by line
Line 2
side * side (or side ** 2) is the area.
Learn the concept
New to this topic? Read the lesson, then come back.