Variables and Data Types

Lesson 1: Variables and Data Types

In this lesson, we’ll cover the following topics:

  1. What are variables?
  2. Basic data types: int, float, str, bool
  3. How to declare and assign variables
  4. Type conversion

Example:


# Declaring variables
age = 25
name = "John"
height = 1.75
is_student = True

# Type conversion
age_str = str(age)
height_int = int(height)

print(f"{name} is {age} years old and {height} meters tall.")
print(f"Is {name} a student? {is_student}")