list in pythn code example
Example 1: list in python
thislist = ["apple", "banana", "cherry"]
print(thislist[1])
Example 2: list in python
#list is data structure
#used to store different types of data at same place
list = ['this is str', 12, 12.2, True]
Example 3: python list
#Creating lists
my_list = [1, "Hello", 3.4, 0, "World"]
my_nested_list = [['Hello', 'World'],[47,39]]
#Accessing lists
my_list[1] # Hello
my_list[-2] # 0
my_list[:3] # [1, "Hello", 3.4]
my_nested_list[1] #[47,39]
my_nested_list[0][1] # World
Example 4: python lists
games = ['Fortnite', 'CS:GO', 'Temple Run']
print(games)