Introduction to Python Programming Getting Started with Python · free preview

What Is Programming, Anyway?

Computers are fast, but not smart

A computer can perform billions of calculations per second, yet on its own it has no idea what you want. It does not guess, improvise, or fill in gaps. Everything useful a computer does — showing a web page, streaming music, calculating your bank balance — happens because a person wrote a precise list of instructions telling it exactly what to do, step by step. That list of instructions is a program, and the act of writing one is programming.

Think about giving a friend directions to your home. If your friend already knows the neighborhood, you can be vague: "head toward the park, it's near there." A computer is like a visitor from another planet who follows directions with total obedience and zero common sense. If you say "turn left" one street too early, it turns left one street too early, every single time. This sounds frustrating, but it is actually the superpower of programming: once your instructions are right, the computer will execute them flawlessly, millions of times, without ever getting tired or bored.

Why Python?

Computers ultimately understand only machine code — patterns of ones and zeros. Writing those directly would be miserable, so we use programming languages: notations that are readable by humans and translatable into something the machine can run. There are hundreds of programming languages, and in this course we use Python. Python was designed with a clear goal: code should be easy to read. Its instructions often look close to plain English, which makes it one of the friendliest first languages ever created. It is also genuinely powerful — Python runs data analysis at research labs, backend services at major tech companies, and automation scripts on millions of laptops.

Here is a complete, real Python program. Even before your first lesson on syntax, you can probably guess what it does:

print("Welcome to Syllabus!")
print(3 + 4)
# prints: Welcome to Syllabus!
# prints: 7

The word print is an instruction that means "display this on the screen." The first line displays a message; the second computes three plus four and displays the result. Two lines, two instructions, executed top to bottom. That top-to-bottom flow is the default rhythm of every program you will write.

How programmers actually think

Programming is less about memorizing commands and more about a way of thinking: taking a big fuzzy goal and breaking it into small unambiguous steps. Suppose you want a program that computes the average of your exam scores. A programmer decomposes that into steps like:

  1. Collect the scores.

  2. Add them all together.

  3. Divide the total by how many scores there are.

  4. Display the result.

A step-by-step recipe like this, written independently of any particular language, is called an algorithm. Once the algorithm is clear, translating it into Python is the easy part. Throughout this course, whenever a problem feels overwhelming, come back to this move: shrink the steps until each one is obvious.

One more mindset shift before we begin. Your programs will contain mistakes — everyone's do, including those written by professionals with decades of experience. A mistake in a program is called a bug, and finding and fixing bugs (debugging) is a normal, everyday part of the craft, not a sign of failure. When something breaks in this course, you are not doing it wrong; you are doing the actual job.

Try it yourself

Without touching a computer, write an algorithm — a numbered list of plain-English steps — for making a cup of tea, aimed at someone who has never seen a kettle. Then hand it to a friend and ask them to follow it with ruthless literalness. Notice where your instructions were ambiguous. That gap between what you meant and what you said is exactly what programming trains you to close.

Curriculum aligned with the openly licensed OpenStax textbook Introduction to Python Programming (openstax.org/details/books/introduction-python-programming), © OpenStax, CC BY 4.0. Lesson text is original to Syllabus.

This is one lesson of the full subject.

Get every module, lesson, and quiz — one-time purchase, lifetime access.