How to Define Variable in Python?

Assign a value using `=`

Example: `x = 10`

Example: `name = “Alice”`

Example: `is_active = True`

Use a valid identifier name

Start with a letter or underscore

Use letters, numbers, and underscores only

Do not start with a number

Do not use Python keywords

Variable names are case-sensitive

Multiple variables can be assigned at once: `a, b = 1, 2`

A variable can be reassigned: `x = 5`

Suggested for You

Trending Today