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...

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

Extracted 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 > 9 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 cells = 8 1
Program Input/Output<br>The table below shows sample test cases with input prompts and corresponding output in Turtle canvas that<br>can be used to debug/test your program. It is recommended to test your program thoroughly and not depend<br>only on the provided test cases.<br>Input Prompts<br>Output (Turtle canvas)<br>Enter number of cells in board: 2<br>Enter the width of each cell: 30<br>Enter the color (black or red or green or blue): black<br>Enter number of cells in board: 5<br>Enter the width of each cell: 15<br>Enter the color (black or red or green or blue): blue<br>Enter number of cells in board: 8<br>Enter the width of each cell: 25<br>Enter the color (black or red or green or blue): red<br>Enter number of cells in board: 1<br>Enter the width of each cell: 5<br>Enter the color (black or red or green or blue): yellow<br>Warning: Invalid number for the cells: 1<br>Using default value of 8 cells instead!<br>Warning: Invalid number for the cells width: 5<br>Using default value of 25 instead!<br>Warning: Invalid color: yellow<br>Using default

Extracted text: Program Input/Output The table below shows sample test cases with input prompts and corresponding output in Turtle canvas that can be used to debug/test your program. It is recommended to test your program thoroughly and not depend only on the provided test cases. Input Prompts Output (Turtle canvas) Enter number of cells in board: 2 Enter the width of each cell: 30 Enter the color (black or red or green or blue): black Enter number of cells in board: 5 Enter the width of each cell: 15 Enter the color (black or red or green or blue): blue Enter number of cells in board: 8 Enter the width of each cell: 25 Enter the color (black or red or green or blue): red Enter number of cells in board: 1 Enter the width of each cell: 5 Enter the color (black or red or green or blue): yellow Warning: Invalid number for the cells: 1 Using default value of 8 cells instead! Warning: Invalid number for the cells width: 5 Using default value of 25 instead! Warning: Invalid color: yellow Using default "black" color instead!
Jun 06, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here