Skip to content
OtisamLMS
Computing

Computing · Quick practice · answer shown after each question

Python: selection and iteration

Question 1 of 10

Question 1 of 10

Write a program that checks whether a number entered by the user is prime.

Question 2 of 10

Question 2 of 10

range(1, 10) includes the number 10.

Question 3 of 10

Question 3 of 10

An infinite loop can be caused by

Question 4 of 10

Question 4 of 10

Write a program that prints the multiplication table of a number entered by the user, from 1 to 12.

Question 5 of 10

Question 5 of 10

What is printed? x = 15 if x > 20: print("A") elif x > 10: print("B") else: print("C")

Question 6 of 10

Question 6 of 10

What does range(4) produce?

Question 7 of 10

Question 7 of 10

What is the final value of total? total = 0 for i in range(1, 6): total += i

Question 8 of 10

Question 8 of 10

Which Python code prints "Even" when n is even?

Question 9 of 10

Question 9 of 10

Explain the difference between break and continue, with an example of each.

Question 10 of 10

Question 10 of 10

Python uses indentation to show which statements are inside a loop.

Questions written by OtisamLMS in the style of the WASSCE. They are not WAEC past questions.