Lists...

 #creating list using []

# it's ordered and changeble

# list = [12, "Aks", 13, True, 14.5]
# print(list)

a = [3, 6, 9, 4, 3, 9, 10]
b = [21, 25, 33]
c = (100, 200, 300)
#Indexing and slicing is same as str
# a.sort()          # sorting list lower to higher value
# a.reverse()       # Higher to lower value
# a.append(15)      # append in last
# a.insert(3,11)    # insert a no.(11) on index 3
# a.pop(0)          # poping out a no. on index 0
#del a[0]
#a.remove(9)        # remove 1st 9
#a[1] = 45          #change the value of 1 index
#a[1:2] = 45, 12    #change the multiple values
#a.extend(b)        #extend a with list b
#a.extend(c)        #extend list with tuple c
print(a)


No comments:

Post a Comment