Python: Practical Python Programming For Beginners and Experts (Beginner Guide) by Jonathan Yates

Python: Practical Python Programming For Beginners and Experts (Beginner Guide) by Jonathan Yates

Author:Jonathan Yates [Yates, Jonathan]
Language: eng
Format: epub, pdf
Published: 2016-07-06T22:00:00+00:00


Basic lists operations

Like Python strings, we can use + and * operators on lists for operations like concatenation and repetition respectively. Below are the list operations on Python lists.

Python Expression

Results

Description

len([1, 2, 3, 4, 5])

5

Length operation.

[1, 2, 3, 4, 5] + [6, 7, 8, 9, 0]

[1, 2, 3, 4, 5, 6, 7, 8, 9, 0]

Concatenation operation.

['Hello'] * 3

['Hello', 'Hello', 'Hello']

Repetition operation.

4 in [1, 2, 3, 4, 5]

TRUE

Membership operation.

for a in [1, 2, 3, 4, 5]: print a,

1 2 3 4 5

Iteration operation.



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.