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