Write a function carpet that takes one nonnegative natural number as the argument and produces a list

Question:

Write a function carpet that takes one nonnegative natural number as the argument and produces a list as shown in the examples.

You may assume that the argument of carpet will always be a nonnegative natural number.
The following examples show a formatted output of the carpets, but your output does not need to look the same regarding spaces. For your output, it is sufficient to produce the list. Spaces in the lists are just for illustrative purposes here; you are not required to print them:image

image

Fantastic news! We've Found the answer you've been seeking!

Step by Step Answer:

Question Posted: