StudyToCert

All certifications / PCEP / Lessons

PCEP – Certified Entry-Level Python Programmer PCEP-30-02 · Domain 4: Functions and exceptions

Return and yield, returning several values as a tuple, the None value

▶ Watch the overview video

Last reviewed September 30, 2026 · Leer en español

The return statement ends a function immediately and sends a value back to the caller. The call expression then evaluates to that value, so you can assign it, print it or use it in a larger expression: total = add(2, 3) or print(add(2, 3) * 10). Any code after an executed return in the same function is skipped, and even a return inside a loop ends the whole function, not just the loop. A function can contain several return statements, for example one in each branch of an if, but only one of them runs per call.

Free account

Keep reading for free

Create a free StudyToCert account to read the rest of this lesson: 7 more sections, 6 key terms, a real-world example, an exam tip and self-check questions. Every lesson, lab and practice test is free with an account.

Sign up free Log in

Study PCEP for free
A week-by-week plan with every lesson, quizzes, checkpoint tests, a practice exam and hands-on labs.
Open the PCEP study plan