You are on page 1of 5

Programming using Python

prutor.ai Amey Karkare


Dept. of CSE
IIT Kanpur

For any queries reach out to rahulgr@iitk.ac.in or rahulgarg@robustresults.com


or whatsapp 9910043510

1
Python Programming
Lists
• Ordered sequence of values
• Written as a sequence of comma-separated

prutor.ai
values between square brackets
• Values can be of different types
– usually the items all have the same type

2
Programming
Lists
• List is also a sequence type
– Sequence operations are applicable

prutor.ai

3
Programming
Lists
• List is also a sequence type
– Sequence operations are applicable

prutor.ai Repetition

( )

4
Programming
More Operations on Lists
• L.pop()
• L.append(x)
• L.index(x)
• L.extend(seq)
prutor.ai
• L.insert(i, x)
• L.count(x)
• L.sort()
• L.remove(x)
• L.reverse()
• L.pop(i)
x is any value, seq is a sequence value (list, string, tuple, …),
i is an integer value 5
Programming

You might also like