nanopython  /  calculator

Calculator

Integer-only calculator driven from main.py. Python owns the state machine; division is integer division (//); overflow shows Error. Built on the nano build (no float, 30-bit smallints).

Loading…

0

Keys: 0–9, + − * /, Enter for =, Esc for C, Backspace deletes.

Notes

State machine: current_value, pending_op, accumulator. On digit press, append to entry (capped at 9 digits to stay under the 30-bit smallint cap). On operator press, apply any pending operation, then store the new one. Division is // (truncated toward negative infinity per Python). Any OverflowError or divide-by-zero displays Error; the next press clears the error.