Page 125 - KEC Khaitan C8 Flipbook
P. 125

PROJECT NAME: Generate Pattern ‘Pyramid of Asterisks’

                 Software Used: Python Editor


                 Step-by-Step Instructions:

                 Plan IPO Framework

                 Step  1   Input:

                              Prompt the user to input the number of rows for the pyramid. The program should
                              accept dynamic inputs for flexibility.

                 Step  2   Process:

                             Use nested loops to:

                              o  Calculate the spaces required for alignment on each row.
                              o  Add the appropriate number of asterisks based on the row number.

                             Mirror the pattern for the bottom half to create a diamond shape.

                 Step  3   Output:

                             Display the pattern. Refer to the sample:

                                                     . . * . .
                                                     . * * * .
                                                     * * * * *
                                                     . * * * .
                                                     . . * . .


                  Code:



































                                                                                                 Hands-On Project  123
   120   121   122   123   124   125   126   127   128   129   130