Ifelse and loops in Python Quiz What will happen if the loop condition is never False? Infinite loop Syntax error The loop stops automatically None How many times will the loop run? python CopyEdit for i in range(1, 6): print(i) Infinite 6 5 4 How do you check if a number is odd in Python? if x % 2 != 0: if x ** 2 == 1: if x // 2 == 0: if x / 2 == 1: What is the purpose of the elif statement? It is used to define a loop. It is a function. It is used to check multiple conditions. It is the same as else. Which of the following is not a valid conditional statement? if x: if (x > 5) if x == 10: if x != 0: What will be the output of the following code? x = 5 if x > 5: print(“A”) elif x == 5: print(“B”) else: print(“C”) C Error A B What will be the output of the following code? x = 10 if x > 5: if x < 15: print("Within range") Error Out of range Within range No output What will range(5) generate? 01234 12345 Error 5 What will be the output of the following code? x = 10 if x > 5 and x < 15: print(“Valid”) Error Invalid No output Valid Which loop is best when the number of iterations is unknown? switch case for loop while loop do-while loop Loading …