Lesson 1, Topic 1
In Progress

Creating variables in Python

John May 22, 2019

Think of a variable as a name attached to a particular object. In Python, variables need not be declared or defined in advance, as is the case in many other programming languages. To create a variable, you just assign it a value and then start using it. Assignment is done with a single equals sign (=):

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

Example

x = 5
y = "John"
print(x)
print(y
Social Community Platform We would like to show you notifications for the latest news and updates.
Dismiss
Allow Notifications