January 2019
Beginner
318 pages
8h 23m
English
In this section, we are going to learn about basic list operations: concatenation and repetition.
The + operator concatenates lists:
>>> a = [30, 50, 60]>>> b = ['Hello', 75, 66 ]>>> c = a + b>>> print c[30,50,60,'Hello',75,66]
Similarly, the * operator repeats a list a given number of times:
>>> [0] * 4[0, 0, 0, 0]>>> ['Python'] * 3['python', 'python', 'python']
Read now
Unlock full access