Running Code and Storing Values
A Python program is a list of instructions run top to bottom, and variables are named boxes that hold values you want to reuse.
Install Python from python.org, then open a terminal and type python3 (or python on Windows) to get an interactive prompt where each line you type runs immediately. That prompt is great for experiments, but real programs live in a file ending in .py that you run with python3 myfile.py. Python reads that file from the first line to the last and does exactly what each line says, in order.
The two things you need today are print and variables. print("hello") displays text on the screen. A variable is created the moment you assign to it: name = "Ana" stores the text Ana under the label name, and age = 34 stores a number. From then on, writing name gives you back that value. Assignment always goes right to left, so total = total + 1 means take the current total, add one, and put the result back in total.
Python cares about types. "34" with quotes is a string, which is text; 34 without quotes is an integer; 34.5 is a float. You can add two numbers, and you can join two strings with +, but adding a number to a string raises a TypeError. Use f-strings to mix them cleanly: f"{name} is {age}" produces Ana is 34. Errors are normal and are not a sign you are bad at this; read the last line of the error message first, because that is where Python names the actual problem.
You want a tip calculator for a dinner bill. In a file called tip.py you write bill = 84.50, then tip_rate = 0.18, then tip = bill * tip_rate, then total = bill + tip, then print(f"Tip: {tip:.2f}, Total: {total:.2f}"). Running python3 tip.py prints Tip: 15.21, Total: 99.71, and changing only the first line updates everything else.
Write a file that stores your first name, your city, and the number of hours you slept last night in three variables, then prints one sentence using an f-string that includes all three. Then deliberately try to write "5" + 5, read the error message, and fix it by converting with int("5").