Skip to content

Commit

Permalink
Basic
Browse files Browse the repository at this point in the history
  • Loading branch information
SanjanaPurbia authored Sep 8, 2021
1 parent 648f73b commit 509f874
Showing 1 changed file with 41 additions and 0 deletions.
41 changes: 41 additions & 0 deletions methods.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
#list methods example
names=["sanjana","hrishita","shruti","manish","kamlesh"]
print(names)

#adding/appending new item
names.append("ram")
print(names)

#returning no of occurance of given item
print(names.count("kamlesh") )

#returns an index of given of given item
print(names.index("manish") )

#extending a list
names.extend(["jadu","dada"])
print (names)

#inserting an item at given index
names.insert(2,"sonu")
print(names)

#removing an item from given item
names.pop()
print(names)

#removing a given item
names.remove("manish")
print (names)

#reversing a list
names.reverse()
print(names)

#sorting a list in given order
names.sort(reverse=True)
print(names)

#copying a list
print(names.copy() )

0 comments on commit 509f874

Please sign in to comment.