7. Lists
name_list = ["mary", "john", "paul"]
len(name_list)
>> 3name_list.append("eric")
name_list
>> ['mary', 'john', 'paul','eric']
len(name_list)
>> 4name_list[0]
>> 'mary'
name_list[3]
>> 'eric'
name_list[0:2] #this retreives the first three elements (0, 1, 2) from the list
>> ['mary', 'john', 'paul']Last updated