© Sanjib Sinha 2017

Sanjib Sinha, Beginning Ethical Hacking with Python, 10.1007/978-1-4842-2541-7_18

18. Containers

Sanjib Sinha

(1)Howrah, West Bengal, India

In Python tuples and lists are array types. Tuples are immutable but lists are mutable. Tuples are used with comma operator and you can iterate through the tuple quite easily. As tuples are immutable, you can not add or update the value of a tuple. In lists, you can update or add new values quite easily. Open up your terminal in Linux and IDLE in Windows. Write down the code below and see the output yourself. Please read the comments that are attached with the code .

<code>#!/usr/bin/python3              tuples1 = 1, 2, 3, 4              print(type(tuples1))              print(id(tuples1))              tuples2 = (1, 2, 3, 4)              print(type(tuples2)) ...

Get Beginning Ethical Hacking with Python now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.