Menu

Sign in to track your progress and unlock all features.

Theme style

Log in

Full lesson preview

Write a function with a simple docstring

Create a small function and include a clear docstring describing its behavior.

Python practice6 minFunctions & ScopeBeginnerLast updated March 17, 2026

Problem statement

Write a function multiply(a, b) that returns the product of a and b. Add a simple docstring to the function exactly: "Multiply two numbers and return the product." Ensure the function behavior matches the docstring and that multiply.__doc__ returns that exact string.

Task

Define a function with an exact docstring and correct behavior so learners practice writing documentation strings.

Examples

Multiply integers

Input

multiply(2, 3)

Output

6

2 * 3 equals 6.

Input format

Two numeric values (integers or floats).

Output format

Return the numeric product of the two inputs.

Constraints

Include the exact docstring: "Multiply two numbers and return the product." The function must return a*b.

Samples

Sample 1

Input

multiply(2.5, 4)

Output

10.0

2.5 * 4 equals 10.0.