Select an option to see the answer and solution.
Python Loops and Conditionals: MCQs for Exam Readiness
practice.
Practice every MCQ with options. Use Show answers when you want the correct option and solution.
91
Questions
2/5
Page
Pick an option on a question to see the right answer and solution.
for i in range(3, 0, -1):
print(i)Select an option to see the answer and solution.
Select an option to see the answer and solution.
x = 5
while x > 0:
print(x)
x -= 1Select an option to see the answer and solution.
x = 0
while x < 5:
print(x)
x += 1Select an option to see the answer and solution.
Select an option to see the answer and solution.
Select an option to see the answer and solution.
for i in range(1, 5, 2):
print(i)Select an option to see the answer and solution.
for i in range(3):
print(i)Select an option to see the answer and solution.
count = 0
while count < 3:
print("Hello")
count += 1Select an option to see the answer and solution.
a = [0, 1, 2, 3]
for a[0] in a:
print(a[0])Select an option to see the answer and solution.
for i in range(5):
if i == 5:
break
else:
print(i)
else:
print("Here")Select an option to see the answer and solution.
for i in range(10):
if i == 5:
break
else:
print(i)
else:
print("Here")Select an option to see the answer and solution.
string = "my name is x"
for i in ' '.join(string.split()):
print (i, end=", ")Select an option to see the answer and solution.
x = (i for i in range(3))
for i in x:
print(i)
for i in x:
print(i)Select an option to see the answer and solution.
string = "my name is x"
for i in string:
print (i, end=", ")Select an option to see the answer and solution.
a = [0, 1, 2, 3]
for a[-1] in a:
print(a[-1])Select an option to see the answer and solution.
x = (i for i in range(3))
for i in x:
print(i)Select an option to see the answer and solution.
string = "my name is x"
for i in string.split():
print (i, end=", ")Select an option to see the answer and solution.
a = [0, 1, 2, 3]
i = -2
for i not in a:
print(i)
i += 1Select an option to see the answer and solution.