Question: To mimic a real-world programming situation, you are given partially-completed code, written by a fomer employee you have just replaced. Your task is to complete

 To mimic a real-world programming situation, you are given partially-completed code,written by a fomer employee you have just replaced. Your task is

To mimic a real-world programming situation, you are given partially-completed code, written by a fomer employee you have just replaced. Your task is to complete the program he was developing. Fortunately, the former employee's documentation is up-to-date and quite useful. (He must have been a QUT student!). Below is the incomplete section of the code, taken from the Python program which is to use Turtle to draw a grid. (In this exercise, a grid is a series of rows, and a row is a series of boxes or squares.) To draw a grd, each box (square) is drawn starting and finishing at the top left hand comer of the box heading east (right). A series of boxes drawn in a horizontal line from left to right for a row. Each subsequent row is drawn undemeath the previous row. The number of rows to be drawn is stored in the variable: number_of_rows. The number of boxes to be drawn in each row is stored in the variable: number_of_columns. The existing function goto_next_box_pos() takes care of repositioning the turtle to where the next box in the row is to be drawn. The existing function goto_next_row_pos() takes care of repositioning the turtle to where the next row is to be dra Here's the incomplete code. The only missing part is a condition. You can safely assume that all of the other code your predecessor wrote is complete and correct. # draw a series of rows of boxes for each_row in range (number_of_rows): # draw a series of boxes in a horizontal line for each column in range (number_of_columns): if (each_column # 2) != 0 draw_grey_box() else: draw_white_box() goto_next_box_pos() goto_next_row_pos() Complete the code so that the first column is shaded, then every second column is shaded. The image below gives an example of the shading pattem required: #draw a series of boxes in a horizontal line for each column in range (number of columns): if (each_column 2) != 0 if (each_column 46 2) == 0 if (each_column 46 2) != 0 if (each_row4f2) == 0 if (each_row 46 2] != 0 Complete the code s if ((each_row + each_column) 4 2) != 0 if (feach_row + each_column) 46 2) == 0 goto shaded. The image below gives an example of the shading pattem required: NB: The operator returns the remainder after integer division

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!