multiple assignment in python code example
Example 1: declare multiple variables at once python
a = b = c = "Hello, World"
print(a)
print(b)
print(c)
# OUTPUT:
# Hello, World
# Hello, World
# Hello, World
b = "foo"
c = "bar"
print(a)
print(b)
print(c)
# OUTPUT:
# Hello, World
# foo
# bar
Example 2: how to assign a value to multiple variables in python
r = kindle = H = 24
#The Three Variables Are All Equal To 24
Example 3: multiple variable declaration in python
a, b, c = 0.1, 100, 'string'
print(a)
# 0.1
print(b)
# 100
print(c)
# string
Example 4: multiple variable declaration in python
a = b = 100
print(a)
# 100
print(b)
# 100