<jupyter_start><jupyter_text>List program  create empty list<jupyter_code>empty_list=[]
type(empty_list)
list1=list()
type(list1)<jupyter_output><empty_output><jupyter_text>create list with element<jupyter_code>list1=[4,2,7,'f',5,"akshay",9.0]
print(list1)
list1=list((2,6,4))   #tuple
list1
list1=list({2,4,7,5})     #set
list1<jupyter_output><empty_output><jupyter_text>print element by using index<jupyter_code>list1=[4,2,7,'f',5,"akshay",9.0]
list1[0]
list1[-len(list1)]<jupyter_output><empty_output><jupyter_text>print last element<jupyter_code>list1[len(list1)-1]
list1[-1]<jupyter_output><empty_output><jupyter_text>print ele by using slice operater<jupyter_code>list1[:]
list1[0:5]
list1[::2]
list1[::-2]<jupyter_output><empty_output><jupyter_text>print reverse list<jupyter_code>list1[::-1]
list1=[9.0, 'akshay', 5, 'f', 7, 2, 4]
list1.reverse()
list1
list1=list1=[9.0, 'akshay', 5, 'f', 7, 2, 4]
list2=[]
for i in reversed(list1):
    list2.append(i)
list2<jupyter_output><empty_output><jupyter_text>list clone<jupyter_code>list2=list1
print(type(list2))
print(id(list1))
print(id(list2))
list2.pop()
print(list1)
print(list2)<jupyter_output>[9.0, 'akshay', 5, 'f', 7, 2]
[9.0, 'akshay', 5, 'f', 7, 2]<jupyter_text>list copy<jupyter_code>list1=[9.0, 'akshay', 5, 'f', 7, 2, 4]
list2=list1[:]
print(list1)
print(list2)
print(id(list1))
print(id(list2))
list2.pop()
print(list1)
print(list2)
list2=list1.copy()
print(id(list1))
print(id(list2))<jupyter_output>1589135705928
1589136020552
StarcoderdataJupyterStructuredCleanDedup