Python Practice › Basic Programs › Program 15

Area of a square

EasyBasic Programs · 15 of 40

Write a Python program to calculate the area of a square. Area = side × side.

Advertisement
Input
side = 6.5
Output
Area of the square: 42.25

Approach

  1. Multiply the side by itself.

Solution

Python
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.

More basic programs

← All 40 Basic Programs

Leave a Comment