28
loading...
This website collects cookies to deliver better user experience
language = 'Python'
print('We are learning', language)
# Output
# We are learning Python
# Initially value 2 is assigned to variable x
x = 2
# Then x refer to string value "Hello World"
x = "Hello World"
# Now x is assigned a list.
x = [1, 2, 3]
# Assign the same value to different variables.
x = y = z = 10
# Create multiple variables simultaneously.
x, y, z = 10, 20, 30
x = 20
text = 'Hello'
y = x
x = 40
x = 20
id(x)
# 10943616
y = 'Python is awesome'
id(y)
# 140399366
z = x
id(z)
# 10943616
PI = 3.14
GRAVITY = 9.8
age = 68
Year = 2019
is_old = True
One23 = 123
# This is not a valid variable name.
12three = 123
# It will give an error
price = 100
Price = 120
Pri_ce = 250