Master the fundamentals of algorithms, pseudocode, flowcharts, Python programming, control structures, and data structures through interactive learning.
Click any card to jump to that section
Understanding algorithms, IPO cycle, pseudocode, flowcharts, and trace tables
An algorithm is a set of steps for solving a problem in a specified order. The process of comprehending an algorithm or a program is called a dry run, which is a commonly used technique for deducing the purpose and output of an algorithm or a program.
The IPO cycle is a tool for problem analysis and an important structure of an algorithm or program:
There are three common ways to express algorithms: everyday words, pseudocode, and flowcharts.
| Operation | Pseudocode | Flowchart Shape |
|---|---|---|
| Start / End | N/A | Rounded rectangle |
| Process / Assignment | A ← 21 | Rectangle |
| Input / Output | Input A, B | Parallelogram |
| Decision | If A = B then | Diamond |
| Sub-program | ProABC | Double-sided rectangle |
A trace table helps us comprehend an algorithm in depth, trace changes in variables and states of inputs/outputs, and spot mistakes.
| Pseudocode | Value of A | Value of B |
|---|---|---|
| A ← 2 | 2 | N/A |
| B ← 5 | 2 | 5 |
| A ← B - A | 3 | 5 |
| A ← A * B | 15 | 5 |
| B ← A - B | 15 | 10 |
Variables, data types, I/O statements, operators, and expressions
Variables are locations in computer memory for data storage. Python has 4 simple data types:
| Type | Description |
|---|---|
int | Integers (positive & negative) |
float | Decimals |
bool | True or False |
str | Text strings |
Output: print() displays content to the console.
Input: input() receives user data as a string. Use int() or float() to convert.
| Operation | Symbol |
|---|---|
| Addition | + |
| Subtraction | - |
| Multiplication | * |
| Division | / |
| Integer Division | // |
| Modulus | % |
| Exponent | ** |
| Meaning | Symbol |
|---|---|
| Equal to | == |
| Not equal to | != |
| Less than | < |
| Greater than | > |
| Less/equal | <= |
| Greater/equal | >= |
() → ** → -(neg) → *, /, //, % → +, - → comparisons → not → and → or
and, or, not are used to combine or negate Boolean expressions.
Selection (if/elif/else) and Iteration (for/while loops)
1D arrays (lists), strings, and 2D arrays
Test your understanding of Chapter 1 concepts
Click cards to flip and review key concepts
Practice with exam-style questions from the textbook