Answered step by step
Verified Expert Solution
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, 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
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