l1=[2,4,6]
l2=[-2,-4,-6]
for i in zip(l1, l2):
print(i)Select an option to see the answer and solution.
Practice every MCQ with options. Use Show answers when you want the correct option and solution.
147
Questions
3/8
Page
Pick an option on a question to see the right answer and solution.
l1=[2,4,6]
l2=[-2,-4,-6]
for i in zip(l1, l2):
print(i)Select an option to see the answer and solution.
def increment_items(L, increment):
i = 0
while i < len(L):
L[i] = L[i] + increment
i = i + 1
values = [1, 2, 3]
print(increment_items(values, 2))
print(values)Select an option to see the answer and solution.
A = [[1, 2, 3],
[4, 5, 6],
[7, 8, 9]]
B = [[3, 3, 3],
[4, 4, 4],
[5, 5, 5]]
zip(A, B)Select an option to see the answer and solution.
a=["Apple","Ball","Cobra"]
a.sort(key=len)
print(a)Select an option to see the answer and solution.
veggies = ['carrot', 'broccoli', 'potato', 'asparagus']
veggies.insert(veggies.index('broccoli'), 'celery')
print(veggies)Select an option to see the answer and solution.
>>>list1 = [11, 2, 23]
>>>list2 = [11, 2, 2]
>>>list1 < list2Select an option to see the answer and solution.
A = [[1, 2, 3],
[4, 5, 6],
[7, 8, 9]]Select an option to see the answer and solution.
l=[[1 ,2, 3], [4, 5, 6], [7, 8, 9]]
[[row[i] for row in l] for i in range(3)]Select an option to see the answer and solution.
A = [[1, 2, 3],
[4, 5, 6],
[7, 8, 9]]
[A[row][1] for row in (0, 1, 2)]Select an option to see the answer and solution.
a=list((45,)*4)
print((45)*4)
print(a)Select an option to see the answer and solution.
l=[[1, 2, 3], [4, 5, 6]]
for i in range(len(l)):
for j in range(len(l[i])):
l[i][j]+=10
lSelect an option to see the answer and solution.
Select an option to see the answer and solution.
t=32.00
[round((x-32)*5/9) for x in t]Select an option to see the answer and solution.
Select an option to see the answer and solution.
w="hello"
v=('a', 'e', 'i', 'o', 'u')Select an option to see the answer and solution.
import math
[str(round(math.pi)) for i in range (1, 6)]Select an option to see the answer and solution.
l=[1,2,3,4,5]
[x&1 for x in l]Select an option to see the answer and solution.
a = [1, 5, 7, 9, 9, 1]
b=a[0]
x= 0
for x in range(1, len(a)):
if a[x] > b:
b = a[x]
b= x
print(b)Select an option to see the answer and solution.
a="hello"
b=list((x.upper(),len(x)) for x in a)
print(b)Select an option to see the answer and solution.
values = [[3, 4, 5, 1], [33, 6, 1, 2]]
v = values[0][0]
for row in range(0, len(values)):
for column in range(0, len(values[row])):
if v < values[row][column]:
v = values[row][column]
print(v)Select an option to see the answer and solution.