Home / Python / Day 1: Python Basics / Variables

Variables

Variables store data values. Python uses dynamic typing — no need to declare types.

Variables in Python

A variable is a named container that stores a value. Python is dynamically typed, meaning you do not declare the type — Python infers it automatically.

Variable Naming Rules

  • Must start with a letter or underscore
  • Can contain letters, numbers, underscores
  • Cannot be a Python keyword
  • Case-sensitive

Multiple Assignment

Python allows multiple assignment in one line.

Type Checking

Use type() to check the data type of a variable.