aienux
Aienux, the AienOS kernel: boot, scheduling, IPC and capability boundaries. Pre-alpha; host, emulator and physical evidence are labelled separately.
Brought by drakestapleton
aienux / evidence / allen-omega-L694 / short.wire
| 1 | CODE 1 1/6 768 a75a7df7 python # calc.py: a small calculator that reads one sum at a time.\nimport operator\n\nOPS = {"+": operator.add, "-": operator.sub, "*": o |
| 2 | CODE 1 2/6 768 a75a7df7 python perator.mul, "/": operator.truediv}\n\n\ndef calculate(a, op, b):\n if op not in OPS:\n raise ValueError("unknown operator |
| 3 | CODE 1 3/6 768 a75a7df7 python " + op)\n if op == "/" and b == 0:\n raise ZeroDivisionError("cannot divide by zero")\n return OPS[op](a, b)\n\n\ndef mai |
| 4 | CODE 1 4/6 768 a75a7df7 python n():\n print("Type a sum like 3 + 4, or q to quit.")\n while True:\n line = input("> ").strip()\n if line in ("q |
| 5 | CODE 1 5/6 768 a75a7df7 python ", "quit"):\n break\n try:\n a, op, b = line.split()\n print(calculate(float(a), op, float(b |
| 6 | CODE 1 6/6 768 a75a7df7 python )))\n except (ValueError, ZeroDivisionError) as e:\n print("Sorry:", e)\n\n\nif __name__ == "__main__":\n main()\n |
| 7 | SAY 1 1/1 Here is a small calculator you can run with python3 calc.py. |