Python Python Collections (2016, retired 2019) Dictionaries Teacher Stats

Aleksandra Laska
Aleksandra Laska
1,955 Points

What is wrong with it ?

Please help me !
# The dictionary will look something like:
# {'Andrew Chalkley': ['jQuery Basics', 'Node.js Basics'],
#  'Kenneth Love': ['Python Basics', 'Python Collections']}
# Each key will be a Teacher and the value will be a list of courses.
# Your code goes below here.

def num_teachers(arg):
    arg = {'Andrew Chalkley': ['jQuery Basics', 'Node.js Basics'],
  'Kenneth Love': ['Python Basics', 'Python Collections']}
    return len(dictionary.keys())

1 Answer

Maxwell Newberry
Maxwell Newberry
Front End Web Development Techdegree Student 7,675 Points

For this challenge, the argument passed to that specific function is the dictionary. Meaning, they're not requiring you to define it. Assuming you're on the first task, the correct function should be laid out like this:

def num_courses(arg):
    return len(arg)

Since the dictionary is being passed as our argument (arg), we can get the length of this argument and return the number of courses using this value.