Python for Data Analytics • Lesson 2

Variables & Naming Rules

Learn how Python stores information using variables, how values can be changed, and how to create valid and readable variable names.

Your progress0%

0 of 8 concepts completed

Complete the activity and related MCQ to unlock the next concept.

Concept 1VARIABLES

What Is a Variable?

A variable is a name that refers to a value in a Python program. It lets you store information once and reuse it later by name.

Learn by Seeing

A name for a value

name = "Yogesh"
age = 20

The name refers to a string; age refers to a whole number.

A variable is a label stuck to a value. Try editing the value:

name→"Yogesh"

Interactive Activity

What is a variable in Python?

Hint: Think of a label attached to a value.

Python Analyst Mindset

Variables are named memory

Analysts use variables to hold totals, clean field names and intermediate results. Naming them well is what makes a script readable six months later — both by you and by anyone else on the team.

01

Assign

Name a value with =.

02

Reuse

Use the name anywhere.

03

Reassign

Update values safely.

04

Name well

Descriptive names, valid syntax.

Frequently Asked Questions

Variables & Naming — FAQs

Is = the same as == in Python?

No. A single = assigns a value. Double == compares two values and returns True or False.

Can a variable name start with a number?

No. Names must start with a letter or underscore. Numbers can appear after the first character.

Are Python variable names case-sensitive?

Yes. score and Score are two different variables.

Why is the old value of a reassigned variable lost?

A variable can only refer to one value at a time. Reassignment replaces the reference, so the old value is no longer stored under that name.

Lesson Summary

What you learned

Variables

Names that refer to values.

= assignment

Connect a name to a value.

Reassignment

The latest assignment wins.

Naming rules

Letters, digits, underscores — no leading digit, no spaces, case-sensitive.