15
15
List
Lists in Python are like arrays in C, but lists can contain data of
different types. The things put away in the rundown are isolated
with a comma (,) and encased inside square sections [].
To gain access to the list's data, we can use slice [:] operators.
Like how they worked with strings, the list is handled by the
concatenation operator (+) and the repetition operator (*).
Look at the following example.
Example:
1. list1 = [1, "hi", "Python", 2]
2. #Checking type of given list
3. print(type(list1))
4.
5. #Printing the list1
6. print (list1)
7.