Variables

A variable in Python is simply a name that refers to a value stored in memory. Instead of working with raw data directly, variables let you label information so it can be reused and manipulated throughout your program.

Declaring Variables in Python

Unlike many other languages, Python does not require you to declare a variable's type. You simply assign a value using the = operator.

name = "Uncodemy"
students = 500
average_rating = 4.8
is_active = True

Rules for Naming Variables

  • Must start with a letter or an underscore, not a number
  • Can contain letters, numbers, and underscores only
  • Case-sensitive, meaning data and Data are different variables
  • Cannot be a reserved Python keyword such as class or for
Choosing clear, descriptive variable names such as total_sales instead of x makes your code far easier to read and maintain, an essential habit for real-world data projects.

Next Up

Now that you can store data in variables, the next topic covers operands and expressions, which allow you to combine and manipulate those values.

Ready to Master Data Science?

Join Uncodemy's Data Science Course and build real, job-ready skills with expert mentors.

Explore Course