Exam-style question
Try this first
Write a Python 3 subroutine called displayEvenTaskNumbers that receives a positive integer taskLimit. It must use iteration to examine the task numbers from 1 to taskLimit, and use selection to display only the even task numbers. Use at least one meaningful identifier and include a constant declaration for the starting task number. Briefly explain how sequence, selection and iteration are combined.
Answer and explanation
Concise answer
START_TASK_NUMBER = 1
Why this is correct
START_TASK_NUMBER is used as a named constant by convention. The statements in the subroutine execute in sequence. The for loop provides iteration through the task numbers, and the if statement provides selection so that only even numbers are displayed. taskLimit and taskNumber are meaningful identifiers because they describe their purposes.
Use the concise answer above for a quick check, then reveal the full model answer and detailed explanation.
Common mistake
No common mistake is linked to this question yet.
