1. Home
  2. Data Science
  3. Python
  4. What is the purpose of the 'return' statement in a function?

Added 5 Feb 2024

What is the purpose of the 'return' statement in a function?

  1. Print a value to the console
  2. Terminate the function executio
  3. Provide a value as the output of the function Correct answer
  4. Define a new variable

Correct answer

C. Provide a value as the output of the function

16 views

MCQSEXAM

Explanation

The 'return' statement is used to provide a value as the output of a function. It signifies the end of the function execution and returns the specified value.

Doubts & discussion

Not sure why the answer is C? Ask here and get an explanation.

Ask a doubt about this MCQ

Shown after review. No links please.

More Python MCQs

Practise all Python MCQs

Similar MCQs