Embercode
✕
Functions and ScopeQuick quiz

Returns in Python

6 questions. Covers Returning multiple values in Python.

Questions 1 to 5 of 6

  1. 1. What does this function give back? ``python def min_max(values): return min(values), max(values) ` The caller writes low, high = min_max([4, 1, 9])`.
  2. 2. What does this program print? ``python def divide(a, b): return a // b, a % b quotient, remainder = divide(20, 6) print(quotient * 10 + remainder) ``
  3. 3. What does this program print? ``python def word_stats(words): longest = "" for w in words: if len(w) > len(longest): longest = w return len(words), longest count, longest = word_stats(["bee", "ant", "cat", "dog"]) print(count, longest) ``
  4. 4. What does this program print? (one line per output) ``python def stats(values): print(min(values), max(values)) result = stats([3, 1, 2]) print(result) ``
  5. 5. What is the name of the type Python uses for a fixed group of values written with commas, such as (1, 9)? Write one word.

    Type your answer.

5 question(s) left on this page.

Typed answers ignore extra spaces and, for most questions, capital letters.