![]() | ![]() |
We create a list in Python by placing items called elements inside square brackets separated by commas. The items in a list can be of mixed data type.
Start IDLE.
Navigate to the File menu and click New Window.
Type the following:
list_mine=[] #empty list
list_mine=[2,5,8] #list of integers
list_mine=[5,”Happy”, 5.2] #list having mixed data types
Practice Exercise
Write a program that captures the following in a list: “Best”, 26,89,3.9