I help startups and teams build production-ready apps with Django, Flask, and FastAPI.
Let’s Talk →I'm always excited to take on new projects and collaborate with innovative minds.
No 7 Street E, Federal Low-cost Housing Estate, Kuje, Abuja 903101, Federal Capital Territory
Python Tutorial for Beginners (Lesson 2): Learn Python variables and data types with examples, screenshots, and exercises for absolute beginners.
Welcome back to the Python Tutorial Series for Beginners! 🎉
In Lesson 1, we installed Python, set up VS Code, and ran our first program.
Now in Lesson 2, we’ll learn one of the most important concepts in programming: Variables & Data Types.
By the end of this lesson, you’ll know how to:
A variable is like a container that stores data in your program.
Think of it as a box with a label on it. You put a value inside, and you can use it later.
Example:
Here,
name is a variable storing a string "Kingsley"age is a variable storing an integer 25
_)_ instead)Age and age are different)✅ Good examples:
❌ Bad examples:
Python automatically understands the type of data stored in a variable. The common types are:
| Data Type | Example | Usage |
|---|---|---|
String (str) | "Hello World" | Text data |
Integer (int) | 25 | Whole numbers |
Float (float) | 3.14 | Decimal numbers |
Boolean (bool) | True / False | Logic values |
str) – Text inside quotesint) – Whole numbersfloat) – Decimal numbersbool) – True or False
You can use the built-in type() function to check what type a variable is:

You can reassign variables at any time:
Try these in your Python file (lesson2.py):
city and store your city’s name.x = 5 and y = 3. Print their sum.Store your age in a variable and print:
Challenge: Create variables for a product: product_name, price, and in_stock. Print them in a single line like:
In this lesson, you learned:
✅ What variables are and how to create them
✅ Rules for naming variables in Python
✅ Python’s main data types (string, integer, float, boolean)
✅ How to check and update variable values
Next up: Lesson 3 – Operators in Python (arithmetic, comparison, and logical operators). 🚀
I'm Kingsley Odume, a Django, Flask, and FastAPI developer with experience building SaaS platforms, APIs, and modern web apps. If you're a recruiter or business owner looking for a reliable software developer, let's connect!
🚀 Hire MeYour email address will not be published. Required fields are marked *