Python Return Values Quiz

  • Questions: 15
  • Easy
  • Pass mark: 70%

A return value is what a function hands back to the code that called it: the fuel left after a burn, whether a launch can go ahead, the lowest and highest reading from a sensor. This free quiz has 15 short questions on what return gives back in Python, when a function returns None, and how to store and use what a function returns.

What the quiz covers

  • What a function returns when no return runs, and how None differs from real values
  • Storing a returned value, and why ignoring it changes nothing
  • Returning booleans, several values, lists and dictionaries
  • Leaving a function early with return: inside an if, a loop or nested loops
  • Using a returned value straight away, and returning one of two values with a conditional expression

How it works

  • 15 questions: 11 with one correct answer, 4 where you select every correct answer
  • After each question you see the correct answer and a short explanation
  • No time limit and no account needed
  • Score 70% or more (11 of 15) to pass

Each topic has a runnable example: return statement basics, returning multiple values, returning a dictionary or a list and early exit from a function. After this one, try the Python Functions Quiz or the Python Tuples Quiz.

This quiz is for registered users. Log in to take it.

Log in

Log in to save this result to your progress. Log in

Next up: Converting Temperatures in Python →