Define a portable binary record
A binary format needs explicit sizes, signedness and byte order. The struct module packs Python values into a byte layout described by a format string. Without an explicit prefix, native alignment and byte order can make a format depend on the machine.
The greater-than prefix selects big-endian standard sizes. A signed short uses two bytes and has a bounded range, so invalid values should raise instead of wrapping silently. Decoding also checks the exact record length. A tiny example is enough to see those bytes and verify the same result on a phone and in WebAssembly.
import struct
record = struct.pack(">hh", -2, 300)
print(record.hex())
print(struct.unpack(">hh", record))Your task
Implement encode_point(x,y) returning a big-endian record of two signed 16-bit integers, and decode_point(blob) returning the pair. Reject out-of-range values or a record whose size is not exactly four bytes.
The explanation opens here once every check passes.