The purpose of this assignment is to learn how to use nested loops and Turtle graphics library to draw complex patterns in Python programming language. Problem Definition Your task is to write python program that draws a board with alternating dark cells (black or some other color) and white cells. The number of cells to use in each row or column, width of each cell, and color to use for dark cells (either black, red, green, or blue) should be collected from the keyboard after showing appropriate input prompt messages. Note the following requirements: The program can either start with a dark (colored) cell or white cell. In the figure below, the board starts with dark cell. The program should draw an N by N board where N is the number of cells in a row (or a column). Note that the shape of board and the cells are both square. The program should draw a border (black line) around the board as shown in the figure. The program must prompt for input from the keyboard and then validate the input as follows: Number of cells in each row or column must be positive number > 1 o Width of each cell must be a positive number >9 o The color can be one of 4 colors only: black, red, green or blue. If any of the provided input is invalid then the program should show a warning message and use the default value for that variable as follows: 8 for the number of cells, 25 for the cell width and black for the color of the dark cells. cell width > 10 nunber of cells

C++ for Engineers and Scientists
4th Edition
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Bronson, Gary J.
Chapter5: Repetition Statements
Section5.5: A Closer Look: Loop Programming Techniques
Problem 12E: (Program) Write a program that tests the effectiveness of the rand() library function. Start by...
icon
Related questions
Question
Preface
The purpose of this assignment is to learn how to use nested loops and Turtle graphics library to draw
complex patterns in Python programming language.
Problem Definition
Your task is to write python program that draws a board with alternating dark cells (black or some other color)
and white cells. The number of cells to use in each row or column, width of each cell, and color to use for dark
cells (either black, red, green, or blue) should be collected from the keyboard after showing appropriate input
prompt messages. Note the following requirements:
The program can either start with a dark (colored) cell or white cell. In the figure below, the
board starts with dark cell.
The program should draw an N by N board where N is the number of cells in a row (or a column).
Note that the shape of board and the cells are both square.
The program should draw a border (black line) around the board as shown in the figure.
The program must prompt for input from the keyboard and then validate the input as follows:
Number of cells in each row or column must be positive number > 1
Width of each cell must be a positive number > 9
o The color can be one of 4 colors only: black, red, green or blue.
If any of the provided input is invalid then the program should show a warning message and use
the default value for that variable as follows: 8 for the number of cells, 25 for the cell width and
black for the color of the dark cells.
cell width > 10
number of cella- 8
1
Transcribed Image Text:Preface The purpose of this assignment is to learn how to use nested loops and Turtle graphics library to draw complex patterns in Python programming language. Problem Definition Your task is to write python program that draws a board with alternating dark cells (black or some other color) and white cells. The number of cells to use in each row or column, width of each cell, and color to use for dark cells (either black, red, green, or blue) should be collected from the keyboard after showing appropriate input prompt messages. Note the following requirements: The program can either start with a dark (colored) cell or white cell. In the figure below, the board starts with dark cell. The program should draw an N by N board where N is the number of cells in a row (or a column). Note that the shape of board and the cells are both square. The program should draw a border (black line) around the board as shown in the figure. The program must prompt for input from the keyboard and then validate the input as follows: Number of cells in each row or column must be positive number > 1 Width of each cell must be a positive number > 9 o The color can be one of 4 colors only: black, red, green or blue. If any of the provided input is invalid then the program should show a warning message and use the default value for that variable as follows: 8 for the number of cells, 25 for the cell width and black for the color of the dark cells. cell width > 10 number of cella- 8 1
Expert Solution
steps

Step by step

Solved in 2 steps with 4 images

Blurred answer
Knowledge Booster
Random Class and its operations
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ for Engineers and Scientists
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr