Unclear instruction for: Iterating over a list in a function


#1



https://www.codecademy.com/courses/python-beginner-nzzVa/3/4?curriculum_id=4f89dab3d788890003000096


My code behaves as expected and I have completed the exercise.

However, the instructions are unclear:

The first paragraph outlines what needs to be done (all ok)

Next follows steps 01-05 with exact instructions (all ok)

Finally there is a paragraph which kind of summarises again what to do, only it talks about getting a count instead of a sum of the items in the list -- contrary to what was just done in step 01 - 05.
The final paragraph looks like something that was originally the introductory paragraph, but has been left there by mistake, or perhaps it belongs to another exercise.

I wrote the following code through step 01-05 and it was accepted as a correct:

n = [3, 5, 7]

def total(numbers):
    result = 0
    for item in numbers:
        result = result + item
    return result

Thus, I just ignored the final paragraph in the instructions, but it should be removed.



#2

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.