Knowledge organisersDesigning, creating and refining algorithms
Complete, write or refine an algorithm
Pseudocode is a simplified, informal way of describing an algorithm that is closer to human language than programming code, but structured like code. OCR uses its own Exam Reference Language as pseudocode in exams. You need to be able to write, read, complete, correct, and refine algorithms written in pseudocode, including using sequence, selection, and iteration.
if/then/else/endif, for/next, while/endwhile, do/until.// Ask user for a number between 1 and 10
valid = false
while valid == false
num = input("Enter a number 1-10: ")
num = int(num)
if num >= 1 AND num <= 10 then
valid = true
else
print("Invalid, try again.")
endif
endwhile
print("You entered: " + str(num))