Getting Started with Python
Python is one of the most popular programming languages in the world, and one of the friendliest for beginners. It's used for everything from web apps and automation scripts to data science and AI.
Your first program
Pythonshares state with other Python blocks
Reading it line by line
print(...)writes text to the console, it's usually the very first thing anyone learns in any language.name = "student"creates a variable, a named container for a value, Python figures out the type (here, a piece of text) automatically, you never have to declare it up front.xp += 10is shorthand forxp = xp + 10, add 10 to whateverxpalready is.f"{name} has {xp} XP"is an f-string, thefright before the quotes lets you embed variables directly inside{ }, without it you'd have to write something clunkier likename + " has " + str(xp) + " XP".
No semicolons, no braces
Unlike many languages, Python doesn't use { } to mark where a block of code starts and ends, it uses indentation (consistent spaces at the start of a line) instead. Get the indentation wrong and Python refuses to run your code, that's a feature, not a bug, it forces code to stay readable.
TIP
Comments start with # and are ignored when the program runs, use them to explain why you did something, not just what the code does.