Menu

Sign in to track your progress and unlock all features.

Theme style

Log in

Problem No 2

Calculate Square of a Number

Easy

8 minute session

Summary

Learn how to compute the square of a given number using a simple function.

Problem statement

You need to create a function named `calculate_square` that takes a single argument (a number) and returns the square of that number. The square of a number is obtained by multiplying the number by itself.

Task

Write a function that takes a number and returns its square.

Examples

Example 1

Input

calculate_square(4)

Output

16

Explanation

The square of 4 is 4 * 4 which equals 16.

Input format

A single integer or float.

Output format

An integer or float representing the square of the input.

Constraints

The input number can be any valid integer or float.

Samples

Sample input 0

5

Sample output 0

25

Explanation 0

The square of 5 is 5 * 5 which equals 25.

Code editor
Loading editor…

AI assistant

Ask me anything!

Need help? I can explain the core idea behind this problem, review your current code, and give targeted hints. Use “Teach Theory” for the concept, “Get AI hint” for a quick scaffold nudge, or ask a specific question below.

Chat history is temporary and will not be saved.

03:23 PM

Free preview includes 1 Teach Theory response and 1 AI hint on each of the first 3 lessons in this module.