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 cach cel, and color to use for dark cell (cither black, red, green, or blue) should be collected from the keyboard after showing appropriate input prompt messages. Note the following requirements: • The program can cither start with a dark (colored) cell or white cll. 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: O 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. ii vi uberof clia

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question
+
X Answered: Proble b
x My Questions | b b
Х ра3-1.pdf
X Python Sandbox
X Python Sandbox
x How to draw Che O
2 )T( واتساب
M
elearn.squ.edu.om/pluginfile.php/1246879/mod_resource/content/1/pa3-1.pdf A
+
1 / 4
ра3-1.pdf
90%
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:
o Number of cells in each row or column must
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
e positive number > 1
black for the color of the dark cells.
cell width > 10
2
nanber of cella- a
3
Transcribed Image Text:+ X Answered: Proble b x My Questions | b b Х ра3-1.pdf X Python Sandbox X Python Sandbox x How to draw Che O 2 )T( واتساب M elearn.squ.edu.om/pluginfile.php/1246879/mod_resource/content/1/pa3-1.pdf A + 1 / 4 ра3-1.pdf 90% 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: o Number of cells in each row or column must 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 e positive number > 1 black for the color of the dark cells. cell width > 10 2 nanber of cella- a 3
+
X Answered: Proble b
X My Questions | b b
х ра3-1.pdf
X Python Sandbox
X Python Sandbox
x How to draw Che
2 )T( واتساب
M
elearn.squ.edu.om/pluginfile.php/1246879/mod_resource/content/1/pa3-1.pdf A
80%
2 / 4
ра3-1.pdf
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
2
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!
3
Transcribed Image Text:+ X Answered: Proble b X My Questions | b b х ра3-1.pdf X Python Sandbox X Python Sandbox x How to draw Che 2 )T( واتساب M elearn.squ.edu.om/pluginfile.php/1246879/mod_resource/content/1/pa3-1.pdf A 80% 2 / 4 ра3-1.pdf 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 2 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! 3
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
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education