
Explore Python fundamentals from setup and environment to variables, data types, and control flow. Learn to build simple, interactive programs in the command line, covering strings, booleans, lists, functions.
Learn fundamental Python programming concepts from variables and data types to control flow. Build simple command line programs using a text editor.
Install Python from python.org and set up Python 3 on your computer, add Python to the path on Windows, and use the interactive interpreter to run hello world.
Explore Python numbers with the interactive interpreter, performing arithmetic on integers and floats and observing automatic casting. Learn float() and int() casting, and practice //, **, and % operations.
Understand variables as containers, how assignment declares them, and Python's naming rules and reserved keywords, then apply order of operations with parentheses and exponents to calculate area and polynomials.
Learn how to declare Python strings with single or double quotes, handle quotes with escape characters and backslashes, and use triple and raw strings for multi-line and Windows path literals.
Explore how to concatenate strings, cast numbers to strings, repeat strings, test membership with in, and master indexing, length, and slicing with zero-based and negative indices.
Explore how Python string methods such as index, find, isdigit, lower, upper, replace, and strip (including lstrip and rstrip) manipulate strings, returning new values and handling not found cases.
Learn Python string methods, including split with whitespace or custom delimiters, and startswith/endswith. Master string formatting with % placeholders for strings, integers, and floats, and control of decimal precision.
Explore booleans in Python by declaring true or false, representing on/off or 0/1, and applying not, and, or, as well as equality and comparison operators on numbers, strings, and booleans.
Discover tuples in Python, a complex data type for aggregating values of mixed types, and master indexing, slicing with negative indices, concatenation, repetition, and membership testing.
Learn how Python lists work, create with square brackets, store mixed types, and use mutability with methods like append, extend, insert, remove, pop, sort, reverse, and indexing and slicing.
Explore dictionary basics in python by mapping names to ages, updating entries, handling missing keys with get and set default, and removing or merging via del, pop, and update.
Explore how Python treats all data as objects, using id and is to distinguish identity from equality, and compare mutable versus immutable types and singletons.
Learn to use the Python if statement to test conditions. Include equality versus assignment, booleans, indentation, elif and else branches, and prints while writing to a file.
Explore Python's if statements with multiple variables, learn truthiness rules for numbers, strings, lists, and tuples, and use short-circuit booleans to write concise conditional code.
Learn how for loops iterate over sequences like lists, strings, and dictionaries, use range and enumerate for indexing, and convert split strings to integers to sum numbers.
Learn to use the while loop to repeat code until a condition becomes false, using an incremented x example and user input. Explore break, continue, and contrast with for loops.
Define functions with def, name parameters, and return results for reuse. Explore named and default arguments and avoid mutable-default traps by creating new objects within the function.
Continue exploring functions in Python, showing how to pass arbitrary arguments with *args and **kwargs, unpack sequences and dictionaries, and customize built-in behavior like print while keeping it simple.
Explore Python exceptions, including value errors and index errors, and master handling them with try-except-finally to control program flow and handle errors.
Explore using multiple except statements to catch a value error and a keyboard interrupt. Learn to read the exception object, observe finally blocks, and raise custom messages that propagate errors.
Calculate the volume of a rectangular box in Python by prompting for length, width, and height, with input validation and graceful error handling.
Learn to write a Python program that sums multiples up to 1000 for a user-provided list of positive integers, with input validation and error handling.
Read two positive integers as width and height to generate a formatted, aligned multiplication table. Use nested loops with dynamic padding from the product and validate input with error handling.
Overview
Python is a programming language that can be used for a wide variety of purposes, from simple user scripts to web servers and complex APIs. It has a simple, highly readable syntax which makes it a suitable language for people who want to learn how to write programs.
What you will learn
We will begin the course by installing the Python 3 interpreter. We will look at how to run the interpreter in the command line, as well as how to execute our Python source files.
After that, we will learn about how to manipulate some basic data types. We will learn about how use Python to do simple arithmetic. Then, we will learn about working with words and characters, using a data type known as the "string". We will also cover the Boolean type, which is a representation of True and False inside of a programming language.
Then we will move on to more complex types. First we will look at how we can organize data into a list. We will look at how to create lists, how to access elements inside them, and how to modify the contents of a list. Then, we will look at the dictionary type, which allows us to create mappings. For example, a dictionary could map account numbers to client names.
We will then move on to control flow. Control flow refers to the sequence in which a program's
statements are executed. We will look at the if statement, which allows the script to decide whether or not to execute a block of code based on some condition. We will also look at looping. Looping refers to repeatedly executing a block of code until some condition is met. Functions will also be covered, which will allow us to organize code into simple, reusable pieces. Then, we will learn about errors, and how to handle them properly so that they do not halt execution of the script.
Finally, we will end the course with three practical coding exercises. These exercises will ask for user input, validate the user input, and display a result in the command line. In cases of invalid input,meaningful error messages will always be displayed to the user. The first exercise will involve asking the user for the length, width and height for a rectangular box. The program will then calculate and display the box's volume. The second exercise will calculate the sum of all multiples of a list of numbers up to 1000. The last exercise will ask the user for a length and a width, and display a multiplication table with the given dimensions.
Prerequisites
Using the command line: In order to execute our coding examples, we will need to use the command line. In Windows, this is the Command Prompt and in MacOS this is the Terminal. For the purposes of this course, students only need to know how to change directories inside the command line. Everything else can be learned by watching the videos.
Python 3: This courses uses Python 3, which has some significant differences from Python 2. The first video of the course will demonstrate how to install Python 3, and how to run it in the command line.
Notepad++ ( Recommended ) : Notepad++ is a free, open-source text editor. Although JavaScript and HTML can be written using any text editor, Notepad++ is highly recommended because of features such as syntax highlighting and auto-complete.