python initialize two variables at once 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: multiple variable declaration in python

a = b = 100

print(a)
# 100

print(b)
# 100

Example 3: python set several variables to none

>>> a=1
>>> a
1
>>> a, b, c, d, e, f, g, h, i, j = (None,)*9
>>> type(a)
<class 'NoneType'>