Python list

In Python a list can be created by placing its elements in the brackets. You can modify content of a list but can't do that with tuple. A tuple can be created by using the parentheses.

Example: create a list called lst and try to modify its element.
>>> lst=[12,34,34]
>>> lst[0]
12
>>> lst[0]=234
>>> lst
[234, 34, 34]

Example: create a tuple called t and try to modify its element.
>>> t=(23,34,23,43)
>>> t
(23, 34, 23, 43)
>>> t[0]=456 # error

Posted by: kumar | post date: 12-16-2012 | Subject: Python Programming Language




This website intents to provide free and high quality tutorials, examples, exercises and solutions, questions and answers of programming and scripting languages:
C, C++, C#, Java, VB.NET, Python, VBA,PHP & Mysql, SQL, JSP, ASP.NET,HTML, CSS, JQuery, JavaScript and other applications such as MS Excel, MS Access, and MS Word. However, we don't guarantee all things of the web are accurate. If you find any error, please report it then we will take actions to correct it as soon as possible.