ExamVeda
Login
Home
41
What will be the output of the following Python code?
a= [1, 2, 3, 4, 5]
for i in range(1, 5):
    a[i-1] = a[i]
for i in range(0, 5): 
    print(a[i],end = " ")
Discuss
Answer & Solution
Answer: Option D
No explanation is given for this question. Let's Discuss on Board
42
Write a list comprehension for number and its cube for l=[1, 2, 3, 4, 5, 6, 7, 8, 9].
Discuss
Answer & Solution
Answer: Option A
No explanation is given for this question. Let's Discuss on Board
43
What will be the output of the following Python code?
A = [[1, 2, 3],
     [4, 5, 6],
     [7, 8, 9]]
[A[i][len(A)-1-i] for i in range(len(A))]
Discuss
Answer & Solution
Answer: Option C
No explanation is given for this question. Let's Discuss on Board
44
What will be the output of the following Python code?
import copy
a=[10,23,56,[78]]
b=copy.deepcopy(a)
a[3][0]=95
a[1]=34
print(b)
Discuss
Answer & Solution
Answer: Option B
No explanation is given for this question. Let's Discuss on Board
45
To insert 5 to the third position in list1, we use which command?
Discuss
Answer & Solution
Answer: Option B
No explanation is given for this question. Let's Discuss on Board
46
What will be the output of the following Python code snippet?
my_string = "hello world"
k = [(i.upper(), len(i)) for i in my_string]
print(k)
Discuss
Answer & Solution
Answer: Option B
No explanation is given for this question. Let's Discuss on Board
47
What will be the output of the following Python code?
>>>m = [[x, x + 1, x + 2] for x in range(0, 3)]
Discuss
Answer & Solution
Answer: Option B
No explanation is given for this question. Let's Discuss on Board