Sololearn quiz answers for python Core: Control structure



 Sololearn mobile application quiz answers for Python Core programming of module control structure:

1. What is the output of this code?

list = [1,1,2,3,5,8,13]

print(list[list[4]])

Ans. 8


2. What does this code do?

for i in  range(10):

    if not i % 2 == 0:

        print(i+1)

Ans: Print all the even numbers between 2 and 10.


3. How many lines will this code print?

While False:

    print("Looping...")

Ans. 0


4.Fill in the blank to print the first element of the list, if it contains even number of elements.

Ans.

list[1,2,3,4]

        if len(list) % 2 == 0:

            print(list[0])


5. What does this code output?

letters ['x','y','z']

letters.insert(1,'w')

print(letters[2])

Ans. y


6. Fill in the blanks to iterate over the list using for loop and print its values.

Ans.

list = [1,2,3]

for var in list:

    print(var)




No comments:
Post a Comment