Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Write a program that displays a checkered pattern of alternating blue and green squares. The colors should alternate in both the vertical and horizontal directions:
Write a program that displays a checkered pattern of alternating blue and green squares. The colors should alternate in both the vertical and horizontal directions: it doesnt matter what the starting color (whichever cell you choose) is. The size and number of squares are input by the user. The required interaction is given below.
Enter the width of the smaller squares: 30 Enter the number of squares: 9 hould not he show n. Use a single turtle. The programs di 1)draw_square()withfourparameters.Thisfunctiondraws a single square at specified location with a certain size and filled with a certain color.
a) x the x cordinate of the point where the square is to be placed
b) y the y coordinate of the point where the square is to be placed
c) width, the length of the side of the square, and
d) color, the color to be used to filling the square
2) draw_patternwithtwoparameters.This function calls draw_square()todrawacer
a) width the length of the side of the smaller square and
b) number of squares , the number of squares in each row column
3) main() with no parameter. The function gets the number of squares and the length of the side from the user and calls the function draw_ pattern()
Enter the width of the smaller squares : 30
Enter the number of squares : 9
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started