# Example, Python list looks like... fruits = ["Apple", "Grapes"] # Example, list holding int and string... mix_list = [1, "two", "two", 1] type(countries)
List is used to store more than one element. Example, list of countries. In Python, list is written with square brackets [ ].
Elements are separated by comma , character. List can hold different data types in same list. List can have duplicate items.
- class 'list'
Working with List
List Index and List Slice are described in details. List supports various operations like: Replace element, Append at end, Extend at end, Insert at start/front, in middle, at end, Remove element by Value, Remove element by Index, Remove All, Reverse elements, Find occurrences of element in list (or Find if element is present or not), Find index of element.
You can create list of lists.