4.3.2.Graded Quiz Loops - sj50179/IBM-Data-Science-Professional-Certificate GitHub Wiki
LATEST SUBMISSION GRADE
100%
Question 1
What is the output of the following few lines of code?
A=[1,2,3]
for a in A:
print(2*a)
11
22
33
2
4
6
correct, each element in the list is an integer, so the '*' represents multiplication
Question 2
What is the output of the following few lines of code?
x=5
while(x!=2):
print(x)
x=x-1
5
4
3
5
4
3
2
the program will never leave the loop
Question 3
What is the output of the following few lines of code?
for i,x in enumerate(['A','B','C']):
print(i+1,x)
1 A
2 B
3 C
0 A
1 B
2 C
0 AA
1 BB
2 CC
Question 4
What is the output of the following?
1
2
3
4
1
3
4
2