<html>
<head>
<meta name="generator" content="Windows Mail 17.5.9600.20605">
<style data-externalstyle="true"><!--
p.MsoListParagraph, li.MsoListParagraph, div.MsoListParagraph {
margin-top:0in;
margin-right:0in;
margin-bottom:0in;
margin-left:.5in;
margin-bottom:.0001pt;
}
p.MsoNormal, li.MsoNormal, div.MsoNormal {
margin:0in;
margin-bottom:.0001pt;
}
p.MsoListParagraphCxSpFirst, li.MsoListParagraphCxSpFirst, div.MsoListParagraphCxSpFirst, 
p.MsoListParagraphCxSpMiddle, li.MsoListParagraphCxSpMiddle, div.MsoListParagraphCxSpMiddle, 
p.MsoListParagraphCxSpLast, li.MsoListParagraphCxSpLast, div.MsoListParagraphCxSpLast {
margin-top:0in;
margin-right:0in;
margin-bottom:0in;
margin-left:.5in;
margin-bottom:.0001pt;
line-height:115%;
}
--></style></head>
<body dir="ltr">
<div data-externalstyle="false" dir="ltr" style="font-family: 'Calibri', 'Segoe UI', 'Meiryo', 'Microsoft YaHei UI', 'Microsoft JhengHei UI', 'Malgun Gothic', 'sans-serif';font-size:12pt;"><div><div>Statement:</div><div>1. The first and last tile in the first row shall be black.<br>2. The first and last tile in the first column shall be black.<br>3. The tiles will alternate between black and lemon<br></div><div><br></div><div>The task is to write a function to compute and print:<br> the number of tiles needed in the first row (the number of columns)<br> the number of tiles needed in the first column (the number of rows)<br> the total number of tiles needed to cover the floor<br> the gap at the end of each row<br> the gap at the end of each column<br>And then print (using a function):<br>1. The colored tile pattern to a graphics window<br>a. The pattern should be printed centered in the graphics window, with equal gaps at <br>the end of each row, and equal gaps at the end of each column</div><div>Use functions to:<br>1. Read and validate the input values<br>a. Width<br>b. Length<br>c. Tile Size<br>2. Compute the number of rows, columns, total tiles required, and the size of the gaps at the <br>end of each row and column<br>3. Print the tile pattern</div><div><br></div><div><br></div><div>This is my outline but some things I do not  know how to do. </div><div><br>
</div>
<div>from graphics import GraphicsWindow</div>
<div><br>
</div>
<div>x = 10</div>
<div>y = 10</div>
<div><br>
</div>
<div>def main() :</div>
<div>--> // do stuff</div>
<div>--> width = getNumber("Choose a width: ", "Invalid value.", 1, 1000)</div>
<div>--> height = getNumber("Choose a height: ", "Invalid value.", 1, 1000)</div>
<div>--> win = GraphicsWindow(width, height)</div>
<div>--> canvas = win.canvas()</div>
<div>--> drawCheckerboard(canvas, x, y, width, height)....</div>
<div><br>
</div>
<div>main()</div>
<div><br>
</div>
<div>According to the constraints he wants you to use convenient functions. Those would likely be, getNumber() and drawCheckerboard()</div>
<div><br>
</div>
<div>You want a number between A and B so we have</div>
<div><br>
</div>
<div># Prompt user with "msg" to return a number between "min" and "max" otherwise output "err_msg"</div>
<div>def getNumber(msg, err_msg, min, max):</div>
<div>--> num = min - 1</div>
<div>--> while num < min or num > max</div>
<div>--> --> num = input(msg)</div>
<div>--> --> if num < min or num > max</div>
<div>--> --> --> print(err_msg) // print invalid msg</div>
<div><br>
</div>
<div># Draws checkerboard</div>
<div>def drawCheckerboard(canvas, x, y, width, height) :</div>
<div>--> // more stuff let me know when you get to this part</div><br></div><div data-signatureblock="true"><div><br></div><div>Sent from Windows Mail</div><div><br></div></div></div>
</body>
</html>