AAlgoLab

Flowchart guide

Every flowchart is a real program. AlgoLab validates its structure, then executes it one node at a time.

Nodes

NodeOutputsBehaviour
StartnextWhere execution begins. Exactly one per flowchart.
InputnextBinds the problem's input values to variables. Created for you from the problem contract.
AssignnextStores the value of an expression in a variable (count) or an element (result[i]).
Decisiontrue / falseEvaluates a condition and follows exactly one branch.
Whilebody / exitRepeats the body while the condition is true. The body must lead back to the While node.
Return—Ends execution and returns the expression as the answer.

Expressions

Expressions use a small Python-like language. They are parsed by AlgoLab — never executed as JavaScript or Python.

+ - *

Arithmetic. + also joins strings and arrays.

/

True division (7 / 2 = 3.5)

// %

Floor division and modulo, Python semantics (-7 // 2 = -4, -7 % 3 = 2)

== != < <= > >=

Comparison. == compares arrays element by element.

and or not

Boolean logic, short-circuiting (&&, ||, ! also accepted)

x in s, x not in s

Membership in a string or array

xs[i], grid[r][c]

Indexing; negative indexes count from the end

[1, 2, 3], []

Array literals

true false null

Literals (True / False / None also accepted)

len(x)

Length of an array or string (length(x) also works)

append(xs, v)

New array with v added at the end

slice(x, start, end?)

Part of an array or string, like x[start:end]

array(n, fill?)

New array of n copies of fill (default 0)

min(...), max(...)

Smallest / largest of the arguments, or of one array

abs(n)

Absolute value

str(x), int(x)

Convert to text / integer

lower(s), upper(s)

Change letter case

is_digit(s), is_letter(s)

Character class checks

Rules worth knowing

Keyboard