Skip to content

Checkout Suggestion on Python Intro for Libraries Lesson: For Loops page #92

@geospatial-gill

Description

@geospatial-gill

In the Python Intro for Libraries Lesson: For Loops episode, it might be clearer to new learners if the first 2 blocks of code were reordered. When I've taught this lesson as a demo, I've done it this way and it seems to go very well. After the introduction on what a For loop does, show the steps the "long way" first, then demo the more elegant way of using a loop to accomplish the same task:

  1. print(2)
    print(3)
    print(5)
  2. This series of print statements is equivalent to a for loop:
    for number in [2, 3, 5]:
    print(number)
  3. And the output for both is the same:
    2
    3
    5

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions