Skip to lesson content
Dev4Hub

Lesson 3 of 11

Python Variables

1 min read2 sectionsAI tutor ready

On this page2 sections
  1. 01Creating Variables
  2. 02Variable Names

Creating Variables

Python has no command for declaring a variable. A variable is created the moment you first assign a value to it.

Declaring Variables

Python
x = 5
y = "John"
print(x)
print(y)

Output

5
John

Variable Names

A variable name must start with a letter or the underscore character. A variable name cannot start with a number, and can only contain alpha-numeric characters and underscores.

You've reached the end of this lesson.

Mark it complete to keep your place in the course — it counts toward your progress and your streak.