Guidelines

How to Calculate Squares in Python

The exponentiation operator ** returns the value of the number on the left raised to the power of the number on the right.

For example, a ** b returns a raised to the power of b.

Exponentiation Example
squared = 2 ** 3 print(squared) # 8

The exponentiation operator is useful for mathematical calculations involving areas, volumes, and more.

Calculating the Area of a Square
side = 5 # Length of one side of the square area_of_square = side ** 2 # Area of the square print(area_of_square) # 25
Mission
0 / 1

Using the Power Operator in Python

Run the following code to calculate the area of a square. The expected output is 49.

side = 7

area_of_square = side 
 2

print(area_of_square)

Guidelines

AI Tutor

Publish

Design

Upload

Notes

Favorites

Help

Code Editor

Run
Generate

Execution Result