Hi,
With this tutorial, I've hit a few questions that I'm not sure what they are asking for. It's in the lesson on lists? Could you please advise what it is they are looking for, because to me it sounds like I'm just filling out the argument as shown when I call the function, but that doesn't really make sense. Here it is:
Q) Add the following set of doctests to the docstring at the top of the file and write Python code to make the doctests pass.

def a_list(l): 
    """
    >>> a_list[3]
    42
    >>> a_list[6]
    'Ni!'
    >>> len(a_list)
    8
    """
a_list([1, 2, 42, 4, 5, ['Ni!'], 7, 8])
if __name__ == '__main__':
    import doctest
    doctest.testmod()

Recommended Answers

All 2 Replies

Looks like they want you to flatten the list.

Or print every 3rd element and then print the length of the list.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.