Deals Of The Week - hours only!Up to 80% off on all courses and bundles.-Close
Dictionary basics
Dictionaries in loops and conditional statements
Dictionaries in functions
13. Dictionaries as function arguments


Perfect. Dictionaries can also be passed to functions as arguments, just like lists. Take a look:

def contains_negative(dictionary_to_check):
  for value in dictionary_to_check.values():
    if value < 0:
      return True
  return False

In the code above, we check whether a given dictionary contains any negative values. Note how we passed in a variable that we assume to be a dictionary. Not really difficult, right?


Write a function named max_value() that takes a dictionary and returns its greatest value. Assume that all values in the dictionary are natural numbers.

Stuck? Here's a hint!

Create a temporary variable in the function with an initial value of 0.