Python variables for beginners
Build your first Python programs with values, variables, expressions, and type conversions.
Understanding variables, expressions, and statements
A variable gives a value a name so you can use it again. Python distinguishes whole numbers, decimal numbers, and text. Practice choosing clear names, calculating with operators, and converting input before using it in arithmetic.
minutes = 90
hours = minutes / 60
print(hours) # 1.5Division with / produces a decimal result. Changing minutes changes the result without changing the calculation.
What you will practice
Work through eight coding missions, then test your understanding with ten multiple-choice questions. Each mission provides starter code, a hint, and feedback after you run it.
- Values and their types — Values and types
- Assignment and updates — Variables; Statements
- Arithmetic toolbox — Operators and operands; Modulus operator
- Precedence workshop — Order of operations; Exercise 4
- Joining and repeating text — String operations
- A personal welcome — Asking the user for input; Exercise 2
- Gross pay calculator — Choosing mnemonic variable names; Exercise 3
- Temperature converter — Exercises: Exercise 5
Your chapter progress is saved in this browser. Complete all 18 checks to unlock a certificate at your earned practice score, and download your notebook or grade report to keep a copy.
Read, practice, and try again
For the chapter reading, see Python for Everybody: Variables, expressions, and statements by Charles R. Severance (CC BY 4.0). ZHUDDLE adds its own practice activities and scoring. The browser runs Python after its first interpreter download; no local installation is required.
Start the variables exercises →