The basics of working with Python

⭐️ 👀 2023 WEB DEVELOPMENT BOOTCAMP starting in days! Join the waiting list to reserve your spot in my 10-weeks cohort course and learn the fundamentals, HTML, CSS, JS, Tailwind, React, Next.js and much much more! 👀 ⭐️


We can create a new Python variable by assigning a value to a label, using the = assignment operator.

In this example we assign a string with the value “Roger” to the name label:

name = "Roger"

Here’s an example with a number:

age = 8

A variable name can be composed by characters, numbers, the _ underscore character. It can’t start with a number. These are all valid variable names:


These are invalid variable names:


Other than that, anything is valid unless it’s a Python keyword. There are some keywords like for, if, while, import and more.

There’s no need to memorize them, as Python will alert you if you use one of those as a variable, and you will gradually recognize them as part of the Python programming language syntax.

Expressions and statements

We can expression any sort of code that returns a value. For example

1 + 1

A statement on the other hand is an operation on a value, for example these are 2 statements:

name = "Roger"

A program is formed by a series of statements. Each statement is put on its own line, but you can use a semicolon to have more than one statement on a single line:

name = "Roger"; print(name)


In a Python program, everything after a hash mark is ignored, and considered a comment:

#this is a commented line

name = "Roger" # this is an inline comment


Indentation in Python is meaningful.

You cannot indent randomly like this:

name = "Flavio"

Some other languages do not have meaningful whitespace, but in Python, indentation matters.

In this case, if you try to run this program you would get a IndentationError: unexpected indent error, because indenting has a special meaning.

Everything indented belongs to a block, like a control statement or conditional block, or a function or class body. We’ll see more about those later on.

One more thing! ⚠️ ✋

At the end of January I will organize the Web Development Bootcamp.

It's a 10-weeks long cohort online course where I will guide you to becoming a Web Developer.

It's not "just a course". It's a big event I organize once a year.

We'll start from zero, learn the fundamentals of Web Development, HTML CSS, JavaScript, Tailwind, Git, using the command line, VS Code, GitHub, Node.js, we'll then learn React, JSX, how to use PostgreSQL, Astro, Next.js, Prisma, deploying on Netlify/DigitalOcean/Fly/Vercel and much more! 

At the end of the first 10 weeks you'll know how to create web sites and web applications and I'll unlock you the 2nd phase of the Bootcamp: you will get access to a large number of projects exclusive to the Bootcamp graduates, so you can follow my instructions to build things like private areas with authentication, clones of popular sites like Twitter YouTube Reddit, create e-commerce sites, and much much more.

Because once you got the fundamentals, you only learn by working on real, exciting projects.

To find out more, visit