You are viewing a free preview of this lesson.
Subscribe to unlock all 10 lessons in this course and every other course on LearningBro.
Variables are the building blocks of every Python program. A variable is a name that refers to a value stored in your computer's memory. In this lesson, you will learn how to create variables, understand Python's core data types, and convert between them.
In Python, you create a variable simply by assigning a value to a name using the = operator:
age = 25
name = "Alice"
pi = 3.14159
is_student = True
print(age) # 25
print(name) # Alice
print(pi) # 3.14159
print(is_student) # True
There is no need to declare the type — Python figures it out automatically. This is called dynamic typing.
_if, for, class, return)age and Age are different)# Valid names
user_name = "Alice"
_count = 10
total2 = 50
MAX_SIZE = 100
Subscribe to continue reading
Get full access to this lesson and all 10 lessons in this course.