Recap Python Basics

This lesson contains a curated collection of Jupyter Notebooks of introductory materials about programming in Python.

Python Refresher as Jupyter Notebooks

In the previous sections you should have installed all required packages for your conda environment, including the Jupyter Notebook.

Create a folder named L0 in your geopython2019 working directory.

Download the linked .ipynb files (Jupyter Notebook files) - right click on the links below (Chapter 1, Chapter 2 etc) and save them into your geopython2019/L0 folder. Go back into the console/commandline prompt (Anaconda prompt), make sure you are in the directory where you extracted the materials. There you should now start the Jupyter notebook.

  1. Open Anaconda Prompt

  2. activate “geopy2019” environment

  3. navigate into your working folder

  4. start Jupyter notebook

All you need to do to play notebooks is to type the following command in your project folder:

cd C:\Users\Alexander\geopython2019

(geopy2019) jupyter notebook

A browser window will open, with the files listed from your geopython2019 folder and you will see the L0 directory. In order to start a Notebook, click on the folder to step into the L0 folder and click on the respective .ipynb file. This will open a new tab in the browser and now you have a running Jupyter notebook session. Cells are tyically either Code (Python) that you can run/execute, or descriptive text in Markdown format.

https://mybinder.org/badge_logo.svg https://mybinder.org/badge_logo.svg
  • Chapter 3: If Statements In this section, you will learn how to test for certain conditions, and then respond in appropriate ways to those conditions.

https://mybinder.org/badge_logo.svg
  • Chapter 4: Loops and Input.ipynb While loops are really useful because they let your program run until a user decides to quit the program. They set up an infinite loop that runs until the user does something to end the loop. This section also introduces the first way to get input from your program’s users.

https://mybinder.org/badge_logo.svg https://mybinder.org/badge_logo.svg https://mybinder.org/badge_logo.svg
  • Chapter 7: Classes and OOP.ipynb In this section you will learn about the last major data structure, classes. Classes are quite unlike the other data types, in that they are much more flexible. Classes allow you to define the information and behavior that characterize anything you want to model in your program.

https://mybinder.org/badge_logo.svg
  • Chapter 8: Exceptions.ipynb Exceptions which are events that can modify the flow of control through a program. In Python, exceptions are triggered automatically on errors, and they can be triggered and intercepted by your code.

https://mybinder.org/badge_logo.svg
  • Appendix: Python Coding Style.ipynb You are now starting to write Python programs that have a little substance. Your programs are growing a little longer, and there is a little more structure to your programs. This is a really good time to consider your overall style in writing code.

https://mybinder.org/badge_logo.svg