Embercode
✕
Pattern PrintingQuick quiz

Grids in Python

6 questions. Covers Checkerboard and grid art in Python.

Questions 1 to 5 of 6

  1. 1. Using the box function from worked example 3, how many . characters does this print? ``python print(box(4, 3, "#", "."), end="") ``
  2. 2. This box test is meant to draw a 3 by 3 border, but the picture is blank: ``python border = (row == 0 and row == size - 1 and col == 0 and col == size - 1) `` What is wrong?
  3. 3. The call box(1, 3, "#", ".") prints a single column of # with no fill. Why?
  4. 4. In the mixed-index program, the row loop starts at 1 and the column loop starts at 0. Why do the colours flip?
  5. 5. Which operator gives the remainder after division, and is used in (row + col) % 2 == 0 to test whether the sum is even? Write the symbol.

    Type your answer.

5 question(s) left on this page.

Typed answers ignore extra spaces and, for most questions, capital letters.