Variables and Data Types

Learn about Python variables and basic data types

Understanding Variables

Variables are containers for storing data values. In Python, you don't need to declare the type of variable - Python automatically determines it based on the value you assign.

Variable Examples

# String variable
name = "Alice"

# Integer variable
age = 25

# Float variable
height = 5.8

# Boolean variable
is_student = True

print(f"Name: {name}")
print(f"Age: {age}")
print(f"Height: {height}")
print(f"Is student: {is_student}")

Lesson Info

Duration 20min
Difficulty

Discussions

Start a Discussion

No discussions yet. Be the first to start one!