Slicing NumPy arrays allows you to edit rectangular blocks of data.
Here is the code that carves out a red square from the image:
.. literalinclude:: flags.py
- the slicing contains an interval
from:to
for each dimension- the smallest
from
value is zero- the highest
to
value is the size of that dimension plus one- negative numbers count from the back
- both
from
andto
can be omitted
Draw the flag of a country of your choice, e.g.: