In [1]:
a_l = [0, 1, 2]
b_l = [10, 20, 30]

a_t = (0, 1, 2)
b_t = (10, 20, 30)

a_s = 'abc'
b_s = 'xyz'

In [2]:
print(a_l + b_l)


[0, 1, 2, 10, 20, 30]

In [3]:
print(a_t + b_t)


(0, 1, 2, 10, 20, 30)

In [4]:
print(a_s + b_s)


abcxyz

In [5]:
# print(a_l + 3)
# TypeError: can only concatenate list (not "int") to list

In [6]:
print(a_l + [3])


[0, 1, 2, 3]

In [7]:
# print(a_t + (3))
# TypeError: can only concatenate tuple (not "int") to tuple

In [8]:
print(a_t + (3, ))


(0, 1, 2, 3)

In [9]:
a_l += b_l
print(a_l)


[0, 1, 2, 10, 20, 30]

In [10]:
a_t += b_t
print(a_t)


(0, 1, 2, 10, 20, 30)

In [11]:
a_s += b_s
print(a_s)


abcxyz

In [12]:
print(b_l * 3)


[10, 20, 30, 10, 20, 30, 10, 20, 30]

In [13]:
print(3 * b_l)


[10, 20, 30, 10, 20, 30, 10, 20, 30]

In [14]:
print(b_t * 3)


(10, 20, 30, 10, 20, 30, 10, 20, 30)

In [15]:
print(3 * b_t)


(10, 20, 30, 10, 20, 30, 10, 20, 30)

In [16]:
print(b_s * 3)


xyzxyzxyz

In [17]:
print(3 * b_s)


xyzxyzxyz

In [18]:
# print(b_l * 0.5)
# TypeError: can't multiply sequence by non-int of type 'float'

In [19]:
print(b_l * -1)


[]

In [20]:
b_l *= 3
print(b_l)


[10, 20, 30, 10, 20, 30, 10, 20, 30]

In [21]:
b_t *= 3
print(b_t)


(10, 20, 30, 10, 20, 30, 10, 20, 30)

In [22]:
b_s *= 3
print(b_s)


xyzxyzxyz

In [23]:
a_l = [0, 1, 2]
b_l = [10, 20, 30]

In [24]:
c_l = a_l + b_l * 3
print(c_l)


[0, 1, 2, 10, 20, 30, 10, 20, 30, 10, 20, 30]