Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Suggestion: introduce getcwd and listdir, and remove lesson content about Markdown #554

Open
srtee opened this issue Jun 21, 2021 · 3 comments
Labels
good first issue Good issue for first-time contributors help wanted Looking for Contributors type:enhancement Propose enhancement to the lesson

Comments

@srtee
Copy link

srtee commented Jun 21, 2021

I have helped in a few courses run based on the Gapminder material, and in common with Issue #528, getting to the correct directory and accessing the files is a common source of grief. My suggestion would be:

  1. put in material in Episode 1 covering working directories in Python, and
  2. remove the material on Markdown from the same Episode.

The high-level argument for (2) is that Markdown is not mentioned throughout the rest of the course material -- furthermore, it is more a feature of Jupyter and other notebook IDEs rather than Python itself. A Python learner will often be stumped by "File not found"-type errors from not knowing how to navigate directory structures in-script (including in the course itself!), far more than wanting to put a notebook cell into Markdown and not knowing how to.

This would entail the following changes:

Objectives

  • Create Markdown cells in a notebook.
  • Print the current working directory and subdirectories and list their contents

Key Points

  • The Notebook will turn Markdown into pretty-printed documentation.
  • Markdown does most of what HTML does.
  • A Python script / JupyterLab notebook has a working directory.
  • The script / notebook will look for files in the working directory using a relative path.

and replacing the Markdown content with some exposition around an exercise to open a new Python cell, run the following commands, and describe the results:

from os import getcwd, listdir
print(getcwd())
print(getcwd()+'/data')

print(listdir('data'))
print(listdir(getcwd() + '/data'))

Learners can be reassured that they will understand the syntax a lot more later on in the course, but for now, they are just learning how to check their working directory and make sure they have their Gapminder data files. Any errors can be handled by instructors and helpers on the spot, making it much more likely that learners will have their scripts / notebooks open in the correct directories and that their data files are already accessible for future use. By moving out the Markdown material, this change will not lengthen the course (and indeed might shorten it by frontloading all the environment setup).

@srtee
Copy link
Author

srtee commented Jun 21, 2021

Alternatively, the material on getcwd and listdir could be placed at the end of Episode 6 (Libraries), which will therefore showcase a very practical and essential example of Python library importing.

Since this would locate the exercise just before Episode 7, where data files are imported for the first time, we would also be introducing all file-system-related material together in a contiguous block and thus make it more memorable and accessible for learners.

@srtee srtee changed the title Suggestion: introduce getcwd and listdir in first lesson, and remove Markdown Suggestion: introduce getcwd and listdir, and remove lesson content about Markdown Jun 21, 2021
@eldobbins
Copy link
Contributor

I really like this idea.

@alee alee added good first issue Good issue for first-time contributors help wanted Looking for Contributors type:enhancement Propose enhancement to the lesson labels Jun 24, 2021
@izaakm
Copy link

izaakm commented Aug 4, 2021

Hello, I've started adding the os library to Episode 6, introducing the functions getcwd and listdir. It seems like it might be important to also include chdir in case students didn't start Jupyter in their home directory, what do you think?

Just to confirm, the markdown should still be removed from Episode 1? With the goal being to keep the total Lesson length approximately the same.

@alee alee linked a pull request Aug 14, 2021 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good issue for first-time contributors help wanted Looking for Contributors type:enhancement Propose enhancement to the lesson
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants