<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>02-Tuples :: My Site</title><link>https://trungnte.github.io/my-fcj-blog/python/02-tuples/index.html</link><description>1. Overview Important A Tuple is rather similar to a list, but is defined using round brackets, (). Tuples can contain multiple elements, and the elements may not share the same type. The key difference is that tuples are immutable, so that once a tuple is created it cannot subsequently be changed. (It can be extended - but this is effectively the creation of a new, larger tuple!). As a lists, the indivisual elements of a tuple can be accessed using [index] after the tuple name. Shell &gt;&gt;&gt; a = (1, 2, 3, 'x', (1, 2, 3), [5, 6, 7]) &gt;&gt;&gt; print(a) (1, 2, 3, 'x', (1, 2, 3), [5, 6, 7]) &gt;&gt;&gt; type(a) &lt;class 'tuple'&gt; &gt;&gt;&gt; 2. Convert to list and vice versa Note A tuple can be converted into a list and vice versa</description><generator>Hugo</generator><language>en</language><lastBuildDate/><atom:link href="https://trungnte.github.io/my-fcj-blog/python/02-tuples/index.xml" rel="self" type="application/rss+xml"/></channel></rss>