Problem Solving

Pseudocode

Students plan a tabletop maze with arrow cards and a notebook.

Pseudocode definition

Pseudocode describes an algorithm in structured language without requiring the exact syntax of a programming language.

In Spanish
pseudocódigo
Topic
Algorithms and problem-solving

Pseudocode in a picture

Pseudocode diagramThe three pseudocode steps find the sum of a list.Set total to 0Give the running total a starting valueFor each item, add it to totalRepeat once for each list entryReturn totalProvide the final result
The three pseudocode steps find the sum of a list.

How it works

Use readable action words for assignments, choices, repetition, and output. A reader should be able to follow the steps or translate them into a program. The formatting can vary as long as the order and conditions are clear.

Worked examples

What does “for each item” mean?

Run the stated action once for every item in the collection.

What would pseudocode “if x < 0, return −x, otherwise return x” compute?

The absolute value of x.

Why indent the body of a repeated step?

It makes clear which actions repeat.

Common mistake

Use an unambiguous operation. Vague directions such as “handle the rest” leave out necessary steps.

Quick check

Does pseudocode require the exact syntax of Python?

What word often begins a decision step?

Show answer

If.

What should pseudocode make clear at the end?

Show answer

What result is returned or how the process stops.

Sources

Flashcard

Pseudocode

Reveal the definition

Pseudocode describes an algorithm in structured language without requiring the exact syntax of a programming language.

Effortless Math. “Pseudocode.” Math Dictionary.