Suppose list1 is [3, 4, 5, 20, 5, 25, 1, 3], what is list1.count(5)? a) 0
View QuestionSuppose list1 is [3, 4, 5, 20, 5], what is list1.index(5)?
Suppose list1 is [3, 4, 5, 20, 5], what is list1.index(5)? a) 0 b) ...
View QuestionTo remove string “hello” from list1, we use which command?
a) list1.remove(“hello”) b) list1.remove(hello) c) list1.removeAll(“hello”) d) ...
View QuestionTo insert 5 to the third position in list1, we use which command?
a) list1.insert(3, 5) b) list1.insert(2, 5) c) list1.add(3, 5) d) list1.append(3, 5) Answer: ...
View QuestionTo add a new element to a list we use which command?
a) list1.add(5) b) list1.append(5) c) list1.addLast(5) d) list1.addEnd(5)
View Question
What will be the output of the following Python code?
>>>list1 = [11, 2, 23]
>>>list2 = [11, 2, 2]
>>>list1 < list2
What will be the output of the following Python code? >>>list1 = [11, 2, 23] >>>list2 = [11, ...
View QuestionSuppose list1 = [0.5 * x for x in range(0, 4)], list1 is:
Suppose list1 = [0.5 * x for x in range(0, 4)], list1 is: a) ...
View QuestionSuppose list1 is [1, 3, 2], What is list1 * 2?
Suppose list1 is [1, 3, 2], What is list1 * 2? a) [2, ...
View Question
What will be the output of the following Python code?
names1 = [‘Amir’, ‘Bear’, ‘Charlton’, ‘Daman’]
names2 = names1
names3 = names1[:]
names2[0] = ‘Alice’
names3[1] = ‘Bob’
sum = 0
for ls in (names1, names2, names3):
if ls[0] == ‘Alice’:
sum += 1
if ls[1] == ‘Bob’:
sum += 10
print sum
What will be the output of the following Python code? names1 = ['Amir', 'Bear', 'Charlton', 'Daman'] names2 = ...
View Question
What will be the output of the following Python code?
>>>names = [‘Amir’, ‘Bear’, ‘Charlton’, ‘Daman’]
>>>print(names[-1][-1])
What will be the output of the following Python code? >>>names = ['Amir', 'Bear', 'Charlton', 'Daman'] >>>print(names[-1][-1]) a) ...
View Question