In [1]:
#https://www.tutorialspoint.com/python/python_lists.htm List
In [2]:
a=[22,44,55]
In [3]:
a
Out[3]:
In [5]:
a[0]
Out[5]:
In [6]:
type(a)
Out[6]:
In [7]:
list1=[1,"ramesh",True,9059868766]
In [8]:
list1
Out[8]:
In [9]:
list2=["hyd",list1]
In [10]:
list2
Out[10]:
In [11]:
a=[2,3,4,[3,4,"r"],"t"]
In [12]:
a
Out[12]:
In [14]:
for i in list1:
print (i)
In [16]:
for i in list2:
print (i)
In [17]:
list1[2]
Out[17]:
In [18]:
list1[1:2]
Out[18]:
In [19]:
list
Out[19]:
In [20]:
list
Out[20]:
In [21]:
list1
Out[21]:
In [22]:
list1[0:2]
Out[22]:
In [23]:
list1[2:4]
Out[23]:
In [24]:
list1
Out[24]:
In [25]:
list1[1]="suresh"
In [26]:
list1
Out[26]:
In [27]:
list3=list1
In [28]:
list3
Out[28]:
In [31]:
del list3[5]
In [30]:
list3
Out[30]:
In [32]:
len(list1)
Out[32]:
In [33]:
list1
Out[33]:
In [34]:
list4=list1+a
In [35]:
list4
Out[35]:
In [36]:
list5=["ramesh"*5]
In [37]:
list5
Out[37]:
In [38]:
2 in list4
Out[38]:
In [39]:
5 in list4
Out[39]:
In [40]:
list4
Out[40]:
In [41]:
list4[-1]
Out[41]:
In [45]:
list4[1:-4]
Out[45]:
In [46]:
li1=range(10)
In [47]:
li1
Out[47]:
In [49]:
print(list(li1))
In [53]:
a=range(1,30)
In [54]:
a
Out[54]:
In [55]:
list(a)
Out[55]:
In [56]:
a=range(0,100,2)
In [57]:
list(a)
Out[57]:
In [58]:
len(a)
Out[58]:
In [59]:
a[-1]
Out[59]:
In [67]:
a[-1]
Out[67]:
In [68]:
a[:-1]
Out[68]:
In [69]:
list(a[:-1])
Out[69]:
No comments:
Post a Comment