You might be wondering: How and why should I start learning Python? To help you answer that, we’ll look at various programming languages and compare a few popular ones with Python.
We look at the history of Python and explore the differences between Python 2 and Python 3. For the course, we use (and recommend) Python 3. Python 2 is legacy, Python 3 is the future and so we recommend learning the latter. The two versions share similarities, so if you learn Python 3, you will still be able to read and understand any legacy Python 2 code you might come upon.
Before you can start coding with Python, you have to ensure that your computer is set up right. I'll take you through the process of installing Python on your MacOS, Windows or Linux OS via the Anaconda distribution. After that, you'll need to install a code editor. I use Sublime Text and would suggest it for this course. But you can use any text editor you prefer.
"How do I know which version of Python have?" is one of the most common questions I hear from students. In this lecture, I'll show you how to verify that you set up your development environment right. You'll test your Python installation and ensure that you have the right version of Python installed—version 3.0 or later.
In this lesson, you'll be introduced to the Command Line, aka the Terminal. We'll show you how to customize your Terminal and then we'll take you through some example Bash commands that you can execute on the Command Line. The Command Line will be used to manage your Python projects and run your Python Code. The commands you learn here will be used throughout the course.
Let's run our first Python script! In this lesson, you'll learn how to navigate the file system with the command line as well as how to run Python scripts. If you browse Github for "Python scripts" you'd see that there are so many useful Python scripts (available for free!), but before you dive in too deep we need to start with the basics: your first Python script!
In this lesson, we go through the Python code that you just ran in the last lesson line by line to understand what it does. You'll be introduced to Python syntax, how to store data in variables as well as how to print out information to the screen.
You just completed your first coding challenge! Cheers to you! In this lesson, I'll walk you through the solution to the challenge. I'll show you how to add data to a Python List, change the output of printed information and points out some syntax errors that you can run into—giving you a brief introduction to debugging, which will be covered in more depth in later lessons.
I want to introduce you to the concept of a randomizer script, and give you your next challenge!
There are two ways in which you can run Python code—by executing a script file with the python command, or by executing commands in the Interactive Shell. You have already done the former. In this lesson, you will be introduced to the Interactive Shell. You will learn how to launch it and use it to execute Python code.
In this lesson, you will learn how to write code that prints data to the screen. Printing information shows us the output of our code, and it is also userful for debugging code. Watch and I'll share a few Python print examples, and than you can create print functions and arguments from scratch.
No developer writes perfect code all the time. One thing you should expect is that your code won't always work as expected. This lesson will show you how to read error messages that are output to the Terminal and how to identify the code that caused the error. Debugging is something we'll be using throughout the course, so by the time you complete it, you'll be quite adept at finding and fixing bugs in your code. In this lesson, I'll also show you how to get the most out of debugging with Google and StackOverflow.
You should strive to write code that is easily readable and understandable. Programming languages allow developers to add annotations (i.e. comments) along the way to help explain what the code is doing. Comments make life easier for you, and for anyone else who may read the code.
Variables are used to label and store data that can be referenced and manipulated by your code. You have already worked with variables in the code you've written so far. This lesson will dive deeper into variables. You'll learn the rules governing the naming of variables as well as some recommended industry conventions to follow.
One thing computers are great at is performing computations. In this lesson, we'll do some Math using Python. You'll learn how to use the common arithmetic operators (e.g. Addition, Subtraction, Multiplication, Division and Modulus) as well as the rules governing the order in which they are executed.
In programming, a string is a sequence of characters. They are usually used to store data in text form. Here, we explore the string format in Python. We see how to create them as well as how to deal with strings that contain special characters through what is referred to as Escaping. I'll also introduce you to Kanye West's "greatest pain."
Sometimes, you usually need to combine the values of two or more variables. How do you put a variable inside a string? Let me show you how!
At some point in your programming career, you will write software that takes input from the user and processes it. This lesson covers how to do this. You will learn how to read and utilize user input. User input usually comes in the form of strings. Sometimes this isn't what your code needs and so we will show you how to cast this into an appropriate type.