Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Using Python!!!! 1.Write a recursive function printPattern() that will generate

ID: 3668557 • Letter: U

Question

Using Python!!!!

1.Write a recursive function printPattern() that will generate the following patterns. Note that the first argument is always a power of 2 and is the max number of stars appearing in the middle row. The second argument (which defaults to 0) is the number of spaces to put before each patterns rows of stars.

>>> printPattern(8,0)

*

**

*

****

*

**

   *

********

    *

    **

     *

    ****

      *

      **

       *

>>> printPattern(4,2)

*

**

   *

****

    *

    **

     *

>>> printPattern(4)

*

**

*

****

*

**

   *

Explanation / Answer

This below python code will print the pattern format as given in problem statement i.e middle of stars print the half the stars.. See the below python code..

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote