This week, you will learn about control flow and working with files in Python.
Some of the things you will learn this week:
Learn when and how to use if
statements, for
loops, and while
loops in Python.
Learn how you can read from and write to files in Python.
CSB Chapter 3.5 - 3.9: “Basic Programming”
Note: Where the CSB text says to save a file as a Jupyter Notebook (with the .ipynb
extension), you can just create a regular Python script (.py
extension) – nothing in the code is specific to Jupyter Notebooks.
If you want to play around with Jupyter Notebooks, you can actually do this in VS Code: simply save a file with the .ipynb
extension and see what happens. Here is some VS Code documentation on its Jupyter support. If you would want to try Jupyter Notebooks in their native environment, you can do so via OSC OnDemand: see this section of this site’s Python resources page.
Text and figures are licensed under Creative Commons Attribution CC BY 4.0. The figures that have been reused from other sources don't fall under this license and can be recognized by a note in their caption: "Figure from ...".