Lists, the most common Python data type, can appear as comma-separated values within square brackets. The items in the list do not need to be of the same type to create a list, just separate items separated by commas and enclosed in square brackets.
List1 = [‘ Google ‘, ‘Runoob, 1997, 2000] list2 = [1, 2, 3, 4, 5] list3 = [” a “, “b”, “c”, “d”] list4 = [‘ red’, ‘green’, “Blue”, “yellow”, “white” and “black”]
Print (list1[1]) starts at 0, so Runoob is printed
Nums = [10, 20, 30, 40, 50, 60, 70, 80, 90] print(nums[0:4])
Delete list element del list[1]
List operators: Len ([1, 2, 3]) 3 length [1, 2, 3] + [4, 5, 6] [1, 2, 3, 4, 5, 6] combination [‘ Hi! ‘] * 4 [‘ Hi! ‘, ‘Hi!’, ‘Hi!’, ‘Hi!’] repeat 3 in [1, For x in [1, 2, 3]: print(x, end=” “) 1, 2, 3 iterates