You are on page 1of 2

print("SHORT ANSWER QUESTIONS")

print('''
1.lists are used to store many different data types and they are mutable.
2.mutility means that the elements in the list can be changed."in place" memory
updation means you can change the elements.
3.append() adds a single element to the end of the list while . extend() can add
multiple individual elements to the end of the list
4.List slicing refers to accessing a specific portion of the list.List slicing
returns a new list from the existing list.
5.In python del is a keyword and pop() is a in-built methods.
The del statement is used to remove an individual element or elements identified by
a slice. The pop() method uses the index of an element to delete it.
6.Membership Operators are the operators, which are used to check whether a
value/variable exists in the sequence like string, list, tuples, sets, dictionary
or not. These operator returns either True or False
7.The pop() method uses the index of an element to delete it.The remove() method
takes a single element as an argument and removes it from the list
8.a[10, 12, 26, 32, 65, 80]
b-[12, 32, 65, 26, 80, 10]
c- output = [1, 3, 5, 7, 9]
output = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
d-5
9.i. output is = [10,20,30,40,[50,60]]
ii. output = [10,20,30,40,80,90]
10.
1
3
5
7
9
''')
print('''
1. Write a statement to declare an Empty List.
2. Write a statement to convert the following string into a list.
Str1=”India is my country.”
3. How lists are implemented in memory?
4. List1 = [2,4,3,5,6]. What will be the output of print (List1[2])?
5. Write the output for
List1 = [2,4,3,5,6]
print (List1.sort())
6. Write the python statement to print a list in reverse order.
7. Write the python statement to change the list;
List1 = [2,4,3,5,6] to List2= [2,14,3,5,6]
8. Write the python statement to pop an element of a list from index 2.
''')
print('''
1.a = []
print("Values of a:", a)
2,
''')
s="India is my country"
x=[i for i in s]
print(x)
print('''
3.For the implementation of a list a contiguous array of references to other
objects is used
4. output-3
5.None
6.list.reverse()''')
List1 = [2,4,3,5,6]
List1[1]="14"
print(List1)
prime = [2, 3, 5, 7]
removed= prime.pop(2)
print(removed)

You might also like