Uploaded by Suruz Ahammed

MidTerm Preparation

What is Tuple? How literals of type tuple are written?Give example?
A tuple is a collection which is ordered and unchangeable. In Python tuples are
written with round brackets.
thistuple = ("apple", "banana", "cherry")
What is List?How list differ form tuples?
List is a collection which is ordered and changeable. Allows duplicate
List is mutable and tuples is
and immutable is memory usage
create a variable, some fixed
list, more memory is assigned
immutable. The main difference between mutable
when you are trying to append an item. When you
memory is assigned to the variable. If it is a
than actually used
How to slice a list in Python?
We can slice a list using python’s slicing operator which has following
syntax : [start : stop : steps]