Python 3 - Lists
Python Lists
The list is the most versatile datatype available in Python, which can be written as a list of comma-separated values (items) between square brackets. Important thing about a list is that the items in a list need not be of the same type.
Creating a list is as simple as putting different comma-separated values between square brackets. For example −
list1 = ['Keen', 'Infotech', 'Udaipur', 2009];
list2 = [1, 2, 3, 4, 5 ];
list3 = ["a", "b", "c", "d"];
The list is the most versatile datatype available in Python, which can be written as a list of comma-separated values (items) between square brackets. Important thing about a list is that the items in a list need not be of the same type.
Creating a list is as simple as putting different comma-separated values between square brackets. For example −
list1 = ['Keen', 'Infotech', 'Udaipur', 2009];
list2 = [1, 2, 3, 4, 5 ];
list3 = ["a", "b", "c", "d"];
Comments
Post a Comment