Basic HTML Version

|  | Table of Contents |  | View Full Version

Page 106 - 2615_KEC
P. 106

    PROJECT 8: 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:

                      104   Premium Edition-VIII

| 101 102 103 104 105 106 107 108 109 110 111 |