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, "\u250C". Be sure not to print a newline. Then create a for-loop to loop through the Lego block width. Each time in the loop should print the block top, "\u2500". Be sure not to print a newline. Following the for-loop, print the top right corner, "\u2510". 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, "\u2502". Be sure not to print a newline. Then create a for-loop to loop through the Lego block width. Each time in the loop should print a Lego block stud, "\u25CB". Be sure not to print a newline. Following the for-loop, print the right side of the block, "\u2502". 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, "\u2514". Be sure not to print a newline. Then create a for-loop to loop through the Lego block width. Each time in the loop should print the block bottom, "\u2500". Be sure not to print a newline. Following the for-loop, print the bottom right corner, "\u2518". 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 for-loop to loop through the Lego block height. Each time in the loop should call DrawMiddle with the width parameter. Following the for-loop, 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.py.u

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!