‹ All courses

An Introduction to Python

A short introduction to Python: video lectures and notebook exercises.

I AM TAKING A PAUSE ON UPDATING THIS PAGE. HOPEFULLY I WILL COME AROUND THIS SUMMER OF 2020.

This is an introduction to Python. Python is the best language to learn as an introduction to computer programming. It is also the most popular language taught at the introductory level at universities. Its syntax is readable, expressive, and flexible yet powerful.

This introduction covers only the essentials of Python, enough to take on some of the other courses on this website, including Image Recognition with Neural Networks and Discrete Fourier Transform. For an excellent and more comprehensive introduction to Python, especially as it relates to data science, see Ryan Soklaski's Python Like You Mean It.

It is recommended that you download the Anaconda distribution which includes latest version of Python, many packages and libraries for scientific computing and a package manager. The code for the lecture exercises below, however, can also be run on the cloud on MyBinder.

Lecture 1: Basic Data Types and OperationsYoutube

Numbers(int, float, complex). Booleans. NoneType. Variables. Math Operations. Logical Operations. Comparison Operations.

Run an interactive version of this code on MyBinder.

Lecture 2: ConditionalsYoutube

If Block. If/If/If. If/Elif/Elif. If/Elif/Else. Ternary Operator.

Lecture 2 ExercisesDownloadNBViewer(Static Renderer)

Run an interactive version of this code on MyBinder.

Lecture 3: LoopsYoutube

For vs While. Range Function. Direct vs. Indirect Loops. User Input. Break and Continue. Nested Loops.

Lecture 3 ExercisesDownloadNBViewer(Static Renderer)

Run an interactive version of this code on MyBinder.

Lecture 4: ListsYoutube

Lists. Useful List Functions. Indexing. Slicing. List Comprehensions.

Lecture 4 ExercisesDownloadNBViewer(Static Renderer)

Run an interactive version of this code on MyBinder.

This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.