Intro to Python-Quiz 5-INT-2240

Intro to Python-Quiz 5-INT-2240
Intro to Python-Quiz 5-
Question 1

What is the output of the following code?

sampleList = [10, 20, 30, 40]
del sampleList[0:6]
print(sampleList)

[]

[10, 20]
Question 2

What is the output of the following list function?

sampleList = [10, 20, 30, 40, 50]
sampleList.pop()
print(sampleList)

sampleList.pop(2)
print(sampleList)

[10, 20, 30, 40] [10, 20, 30, 50]

[10, 20, 30, 40] [10, 20, 40]

[20, 30, 40, 50] [10, 20, 40]

Question 3
aList = [1, 2, 3, 4, 5, 6, 7]
pow2 =  [2 * x for x in aList]
print(pow2)

[2, 4, 6, 8, 10, 12, 14]

[15, 10, 5]

[10, 5]

[25, 10]

Question 4

Select all the correct options to copy a list

aList = ['a', 'b', 'c', 'd']

newList = aList.copy()

newList = copy(aList)

Question 5

 In Python, list is mutable

True

False

Question 6
aList = [4, 8, 12, 16]
aList[1:4] = [20, 24, 28]
print(aList)

[4, 20, 24, 28, 8, 12, 16]

[4, 20, 24, 28]

Answer Preview-Intro to Python-Quiz 5-INT-2240

Intro to Python-Quiz 5-INT-2240

$3.00

Posted

in

by

Tags: