An agricultural engineer is writing a Python program to populate a 4×4 4 \times 4\,4×4 2D array representing a grid of soil moisture readings. Each cell in the grid is filled with a moisture value returned by the function get_moisture().
Complete the Python program in the code block below by filling in the five gaps on lines 9, 12, 14, and 16 so that the array is correctly populated.
1 moisture_grid = [ [0.0, 0.0, 0.0, 0.0],
2 [0.0, 0.0, 0.0, 0.0],
3 [0.0, 0.0, 0.0, 0.0],
4 [0.0, 0.0, 0.0, 0.0] ]
5
6 y = 0
7 while y < 4:
8
9 x = _____
10 while x < 4:
11
12 moisture_grid[ _____ ][ _____ ] = get_moisture()
13
14 _____
15
16 _____
Practise AQA GCSE Computer Science Data structures with exam-style questions for GCSE Computer Science. 37 questions, matched to the AQA GCSE Computer Science (8525) specification and written in Paper 1 and Paper 2 style. Every question includes a full worked solution and mark scheme, so you can see where marks are awarded rather than just whether you got the answer right.