LearnFrenzy
Sign in Take a free test

Functions · Functions MCQ · Question 15

print versus return Answer, explanation & discussion

  • MCQ
  • Easy
  • 0 comments
  • Answer explained
  • Moderated community
Question 15 Back to Exercise

Why is return usually better than print inside a function?

  • A print is slower
  • B print is not allowed in functions
  • C The caller can use the returned value in further calculations; a printed value is only shown Correct
  • D return also prints the value
Correct Answer: Option C

A function that prints returns None, so x = f() * 2 fails.

Discussion & Comments 0

Share your method, a shortcut, or ask about a step you didn't follow.

No comments yet. Be the first to share your solution!

Post your comment

Comments appear after a quick review by our team.

Search LearnFrenzy

Esc

Quick links