What is Python and Why Learn It?

Understand what Python is, why it is one of the most popular languages in the world, and what you can build with it.

~20 min Beginner

A translator between you and the computer

A computer is very fast, but it is not very clever. It does not understand English, or any human language. Deep down it only understands electrical signals that we write as 0s and 1s. So how do we tell it what to do? We use a programming language, which works like a translator between you and the machine.

Python is one of those languages. You write instructions in Python, Python translates them, and the computer follows them. Those instructions are called code, and a file full of code is called a program.

Think about giving directions to a friend. If you say "turn left at the shop, then walk straight for two minutes", your friend can follow you step by step. Python code works the same way. You describe the steps in order, and the computer carries them out exactly as written, no more and no less.

  • Created by a Dutch programmer named Guido van Rossum
  • He started working on it in 1989 and released the first version in 1991
  • The name comes from the British comedy show Monty Python, not the snake
  • Google, Netflix, Instagram, Spotify and even NASA use it every day

It is one of the top three most used programming languages in the world, which means there are tons of tutorials, tools and jobs for it.

Easy to read, even on day one

Many programming languages are hard to read, even for experienced people. Python was designed to look almost like plain English, and you do not need a pile of setup code just to get started.

Showing the words Hello World on screen takes exactly one line:

print("Hello World")

That is the whole program. print is a built-in tool that shows something on the screen. The text you want to show goes inside the brackets, wrapped in quotes. Run it and you see:

Hello World

To see why this matters, here is the same job in Java, an older and stricter language:

public class Hello {
    public static void main(String[] args) {
        System.out.println("Hello World");
    }
}

Same result, five lines, and a lot of words you cannot understand yet. With Python you spend your energy on learning to think like a programmer, not on memorizing rules.

What can you build with it?

Python is a general purpose language. That means it is not made for just one kind of job. Here are the biggest areas, each with a real example:

  • Web development: websites and web apps with tools like Django and Flask. Think of the server that sends you a page when you open a website.
  • Data analysis: studying large amounts of data to find patterns, like which products sell best each month.
  • AI and machine learning: libraries like TensorFlow and PyTorch are used to teach computers to recognize images or understand text.
  • Automation: scripts that rename hundreds of files, send emails or copy data for you, so you never do a boring task by hand again.
  • Cybersecurity: pen testers build tools and automate tasks, for example a script that checks which doors of a computer are open.
  • Game development: small games with a library called Pygame.
  • Scientific computing: calculations and simulations for physics, engineering and biology.

You do not need to pick one now. The basics you learn in this course are the same in every area, so you can choose a direction later.

Python next to other languages

You will hear a lot of language names. Here is how Python compares with three popular ones:

  • Python vs JavaScript: JavaScript mainly makes websites interactive in the browser. Python is better for data, automation and backend work. Many developers learn both.
  • Python vs Java: Java is stricter and needs more code for the same job. Python is faster to write and easier to read.
  • Python vs C++: C++ runs faster but is much harder to write. Python is slower but far easier for everyday tasks.

Notice that none of these languages is simply better. Each one is a tool for different jobs, like choosing between a screwdriver and a hammer. The skills you learn here, such as variables, loops and functions, carry over to all of them.

Which language first? If you are new to programming, Python is the best first language for almost everyone. You get to learn how to think like a programmer without fighting complicated rules.

Python 2 vs Python 3

There are two major versions of Python. Python 2 is old and stopped being supported in January 2020, so do not learn it. Everything in this course uses Python 3. Always use Python 3 for anything new.

One quick way to spot an old tutorial is the print line:

print "Hello"      # Python 2 style, no brackets
print("Hello")     # Python 3 style, with brackets

If you see the old style, the tutorial is outdated and other parts of it may not work either.

This course starts from zero, with no experience needed. You will write your first program, work with numbers and text, make decisions, repeat actions, organize code into functions, and finish with a small real project.

How a Python program actually runs

When you run a Python program, a tool called the interpreter reads your file. It starts at the top and reads one line at a time, going down. For each line it figures out what you asked for and then does it, before moving to the next line.

print("Step one")
print("Step two")
print("Step three")
Step one
Step two
Step three

The order matters. Python never skips ahead on its own, and it never goes back unless you tell it to (you will learn how with loops and functions).

What if you make a mistake? Python stops and tells you what went wrong and on which line. This is called an error message. Beginners often feel scared when they see one, but error messages are your friend. They are Python telling you exactly where to look.

print("This line works")
print("This line is missing a bracket"

Running that gives a SyntaxError and points at the line with the problem. Read the message, fix the line, and run it again. Every programmer in the world does this hundreds of times a day.

Things beginners worry about

  • "I am bad at math." You do not need advanced math to learn Python. Basic arithmetic is enough for most programs. The real skill is breaking a problem into small steps.
  • "Python is too slow." It is slower than C++, but for most tasks you will never notice. Many huge companies run on Python.
  • "I need a powerful computer." Any computer made in the last ten years works fine. You can even run Python on a phone.
  • "I will break something." You will not. A mistake in your code gives an error message and nothing else, so experiment freely.

The best way to learn is to type the examples yourself, change them, and see what happens. Reading alone is not enough, so keep a code editor open while you go through each lesson.

Key takeaways

  • A programming language is a translator between you and the computer
  • Python was created by Guido van Rossum, first released in 1991, and named after Monty Python
  • Python reads like English, so print("Hello World") is a full program
  • It is used for web, data, AI, automation, security, games and science
  • Python 2 is retired. Always use Python 3, where print uses brackets
  • Python runs your code from top to bottom, one line at a time, and error messages help you fix mistakes
Sign up to track your progress Mark lessons as read and pick up where you left off Byte: What is Python? Reinforce what you just read with an interactive Byte