List
The data type list is an ordered sequence which is mutable and made up of one or more elements. Unlike a string which consists of only characters, a list can have elements of different data types, such as integer, float, string, tuple or even another list. A list is very useful to group together elements of mixed data types. Elements of a list are enclosed in square brackets and are separated by comma. Let us take some examples of lists in Python programming. #list1 is the list of five numbers
>>> list1 = [10,20,30,40,50]
>>> print(list1) [10,20,30,40,50] #list2 is the list of vowels
>>> list2 = ['a', 'e', 'i', 'o', 'u']
>>> print(list2) ['a', 'e', 'i', 'o', 'u'] #list3 is the list of mixed data types
>>> list3 = [100, 23.5, 'Hello']
>>> print(list3) [100, 23.5, 'Hello'] #list4 is the list of lists called nested #list
>>> list4 =[['Physics',101], ['Chemistry',202], ['Maths',303]]
>>> print(list4) [['Physics', 101], ['Chemistry', 202], ['Maths', 303]]