Python Practice › Basic Programs › Program 17

Surface area of a cube

EasyBasic Programs · 17 of 40

Write a Python program to calculate the surface area of a cube. Surface area = 6 × a².

Advertisement
Input
a = 4
Output
Surface area of the cube: 96

Approach

  1. A cube has 6 square faces, each of area a².

Solution

Python
a = 4surface_area = 6 * a ** 2print("Surface area of the cube:", surface_area)
Output
Surface area of the cube: 96

Line by line

Line 2

Six faces times the area of one face, a ** 2.

Advertisement

Learn the concept

New to this topic? Read the lesson, then come back.

More basic programs

← All 40 Basic Programs