Question: Using Python Programming Specifications Define a function called DrawTop. This function takes one parameter, which is a number that represents the Lego block width. The
Using Python
Programming Specifications
Define a function called DrawTop. This function takes one parameter, which is a number that represents the Lego block width. The function first prints the top left corner, uC Be sure not to print a newline. Then create a forloop to loop through the Lego block width. Each time in the loop should print the block top, u Be sure not to print a newline. Following the forloop, print the top right corner, u Finally print a newline.
Define a function called DrawMiddle. This function takes one parameter, which is the Lego block width. The function first prints the left side, u Be sure not to print a newline. Then create a forloop to loop through the Lego block width. Each time in the loop should print a Lego block stud, uCB Be sure not to print a newline. Following the forloop, print the right side of the block, u Finally print a newline.
Define a function called DrawBottom. Much like the other functions, it takes one parameter, which is a number that represents the Lego block width. The function first prints the bottom left corner, u Be sure not to print a newline. Then create a forloop to loop through the Lego block width. Each time in the loop should print the block bottom, u Be sure not to print a newline. Following the forloop, print the bottom right corner, u Finally print a newline.
Define a function called DrawLegoBlock. This function takes two parameters, the first attribute is the Lego block width, the second attribute is the Lego block height. The function first calls DrawTop with the width parameter. Create a forloop to loop through the Lego block height. Each time in the loop should call DrawMiddle with the width parameter. Following the forloop, call DrawBottom with the width parameter.
Prompt the user for a width and height of a Lego block to make. Use these variables as the parameters to call DrawLegoBlock.
Save your program as a Python file named legoFactory.pyu
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
