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 server.
Create a folder named
L0 in your geopython2020 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
Go back into the console/commandline prompt (Anaconda prompt), make sure you are in the directory where you extracted the materials. Then you should start the Jupyter notebook server in this
geopython2020 base directory.
Open Anaconda Prompt
activate “geopy2020” environment
navigate into the
start Jupyter notebook server (aka jupyter lab)
All you need to do to play notebooks is to type the following command in your project folder:
cd C:\Users\Alexander\geopython2020 (geopy2020) jupyter lab
A browser window will open, with the files listed from your
geopython2020 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.
Chapter 1: Variables, Strings and Numbers.ipynb In this section, you will learn to store information in variables.
Chapter 2: Lists, Tuples and Sets.ipynb In this notebook, you will learn to store more than one valuable in a single variable.
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.
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.
Chapter 5: Dictionaries.ipynb (Data Structures) Dictionaries allow us to store connected bits of information. For example, you might store a person’s name and age together.
Chapter 6: Introducing Functions.ipynb Functions mean less work for us as programmers, and effective use of functions results in code that is less error-prone.
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.
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.
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.
License and Sharing Material¶
Valerio Maggio https://github.com/leriomaggio/python-in-a-notebook
This work is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.