An Introduction to Python
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 Operations
Numbers(int, float, complex). Booleans. NoneType. Variables. Math Operations. Logical Operations. Comparison Operations.- Lecture 1 Exercise (Download, NBViewer(Static Renderer)) Run an interactive version of this code on MyBinder.
Lecture 2: Conditionals
If Block. If/If/If. If/Elif/Elif. If/Elif/Else. Ternary Operator.- Lecture 2 Exercises(Download, NBViewer(Static Renderer)) Run an interactive version of this code on MyBinder.
Lecture 3: Loops
For vs While. Range Function. Direct vs. Indirect Loops. User Input. Break and Continue. Nested Loops.- Lecture 3 Exercises(Download, NBViewer(Static Renderer)) Run an interactive version of this code on MyBinder.
Lecture 4: Lists
Lists. Useful List Functions. Indexing. Slicing. List Comprehensions.- Lecture 4 Exercises(Download, NBViewer(Static Renderer)) Run an interactive version of this code on MyBinder.