Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Practical Neo4j

Authors: Gregory Jordan

1st Edition

1484200225, 9781484200223

More Books

Students also viewed these Databases questions