Predict Python Function Output
Predict OutputBeginner
Question
What does this Python code print?
Code
def square(n):
return n * n
print(square(5))
Hint
The function returns n multiplied by itself.
Explanation
The function square takes a parameter n and returns n * n (n squared). When called with square(5), n is 5, so the return value is 5 * 5 = 25. print() outputs that result: 25
Related Resources
Related Lessons
- Python Functions
Learn how to define and call functions in Python.
Related Reference
- Python String Reference
Reference for Python string methods.
Look up unfamiliar terms
A beginner-friendly glossary explains jargon in plain English — variables, functions, DOM, Promise, and more.
Decode error messages
Plain-English explanations of common errors — what they mean, why they happen, and how to fix them.
Build real projects
Apply what you learned by building guided projects with starter code and solutions.