Question: Question 3 : Draw Rectangle (4 points) Write a function that takes 2 parameters w and h that specify the dimensions of a rectangle, and


Question 3 : Draw Rectangle (4 points) Write a function that takes 2 parameters w and h that specify the dimensions of a rectangle, and returns that rectangle as a string. The rectangle should be composed of the * character. Rows in the rectangle should be separated by the new line character . When printed, the rectangle should display with the specified width and height. ie, DrawRec(3,4) will be *** *** *** ***
Question 3: Draw Rectangle (4 points) Write a function that takes 2 parameters w and h that specify the dimensions of a rectangle, and returns that rectangle as a string. The rectangle should be composed of the * character. Rows in the rectangle should be separated by the new line character . When printed, the rectangle should display with the specified width and height. ie, DrawRec(3,4) will be *** *** *** *** def DrawRec (w,h): pass # YOUR CODE HERE DrawRec(4,8) DrawRec (6,2) print(DrawRec(4,8)) # Expected Output: # **** # **** # **** # **** # **** # **** # **** # **** # print(DrawRec (6,2)) # Expected Output: # ****** # * * + **
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
