Q.1.
What will be the output of the following Python code? >>>names = ['Amir', 'Bear', 'Charlton', 'Daman']>>>print(names[-1][-1])
Q.2.
What will be the output of the following Python code? names1 = ['Amir', 'Bear', 'Charlton', 'Daman']names2 = names1names3 = names1[:] names2[= 'Alice'names3[= 'Bob' sum = 0for ls in (namesnamesnames3): if ls[== 'Alice': sum += if ls[== 'Bob': sum +=print sum
Q.3.
Suppose list1 is [2], What is list1 * 2?
Q.4.
Suppose list1 = [0.5 * x for x in range(4)], list1 is:
Q.5.
What will be the output of the following Python code? >>>list1 = [23]>>>list2 = [2]>>>list1 < list2
Q.6.
To add a new element to a list we use which command?
Q.7.
To insert 5 to the third position in listwe use which command?
Q.8.
To remove string “hello” from listwe use which command?
Q.9.
Suppose list1 is [5], what is list1.index(5)?
Q.10.
Suppose list1 is [3], what is list1.count(5)?