Hey If you are beginner and want to learn a python then you are on right path. Learn basic as well as advanced programming in Python.

Search

Python program showing execution of all list operations in Single Program.

PYTHON PROGRAM





#Program for discussing all List Operations.

l=[1,3,5,7,8,11,12,13]

l.append(15)

l.append(17)

print(l)

l.remove(12)       #it remove actual value given in()

print(l)

l.pop(4)              #it remove value at position enterd.

print (l)

l.insert(4,9)

"""

Syntax ==>

insert(position,actual_Value)

"""

print(l)

print(max(l))

print(min(l))

l.reverse()

print(l)

l.sort()

print(l)

L=[i for i  in range(18) if i%2==0]

print(L)

L.extend(l)

print (L)

L.sort()

print (L)

L.append(12)

L.append(12)

print(L.count(12))

l.clear()

print (l)

L.clear()

print(L)




*** Input && Output ***











No comments:

Post a Comment

let me know which type examples you want to comment me.