A drone is programmed to scan an ecological reserve to locate the nesting site of an endangered species. The reserve is partitioned into a grid with 5 sections (rows) and 6 zones (columns).
Figure 1 shows a segment of the control program used to identify the coordinate of the nesting site.
Figure 1
nest_section = -1
nest_zone = -1
for s in range(0, 5):
for z in range(0, 6):
if check_habitat(s, z) == "Eagle Nest":
nest_section = s
nest_zone = z
Figure 2 shows an example layout of the monitored reserve grid.
Figure 2
| Zone 0 | Zone 1 | Zone 2 | Zone 3 | Zone 4 | Zone 5 | |
|---|---|---|---|---|---|---|
| Section 0 | Empty | Empty | Empty | Empty | Empty | Empty |
| Section 1 | Empty | Empty | Empty | Empty | Empty | Empty |
| Section 2 | Empty | Empty | Empty | Eagle Nest | Empty | Empty |
| Section 3 | Empty | Empty | Empty | Empty | Empty | Empty |
| Section 4 | Empty | Empty | Empty | Empty | Empty | Empty |
Explain the purpose of the first iteration structure (the outer loop) in the program in Figure 1.
298 exam-style questions on AQA GCSE Computer Science Programming concepts. Each one has a worked solution and a mark scheme showing where the marks go.