I have an assignment as follows:
Write a program which reads from the keyboard two integers n and m, and a character c from the keyboard. This program should define and call a function: print rectangle(n, m, c) which prints a rectangle of size n x m consisting of the character c
My solution is:
n=int(input("Enter the lenght of the rectangle: "))
m=int(input("Enter the width: "))
c="c"
def print_rect(n, m, c):
for a in range(m):
print (n*c)
print_rect(n, m, c)
input("Press enter to close")
I am sure there are alternative ways to do this assignment. How would you code this assignment? Do you think my solution is OK?