Writing and Refining Algorithms - Word Drop
Drop the words into the correct position in the paragraph. Press submit to check your answers.
An algorithm for a described problem can be written as ______, a code-like plan that ignores one language's rules, or as code in a high-level language such as Python. Interpreting an algorithm means stating what it does, what it ______ for given inputs and how many times a loop runs.
input() reads what the user types and print() shows results. A for loop with ______ repeats a set number of times and stops before its end value, while a while loop checks its condition before each pass. A loop that must run at least once needs a ______ variable, set so the condition is true the first time. Putting one construct inside another is ______, shown in Python by the ______.
Common errors in the code stop the program running: a missing ______ at the end of an if, elif, else, for or while line, a misspelt keyword, a wrongly capitalised name, and = instead of ______ in a condition. An off-by-one error in range, where a loop runs one time too few, is a ______ error. input() returns a string, so a number used in arithmetic must be cast to an ______ first.
Completing an algorithm means filling in the missing ______ of code so it matches the description. Refining means making an algorithm more ______, or adapting it to new requirements: repeated code can become a loop, separate if statements can become if and ______, and a ______ is a value that never changes, written in capitals.
Log in or sign-up to access the word drop