Basic HTML Version

|  | Table of Contents |  | View Full Version

Page 126 - 2615_KEC
P. 126

    Output
                       Enter your age: 25
                       The price of the ticket is Rs. 350.

                      Program 30: To create a number pattern using for loop.

                          Program30.py

                       File  Edit  Format    Run   Options   Window    Help

                       #Program to create number pattern using for loop
                       for i in range(1,5):
                           print('3' * i)

                          Output
                       3
                       33
                       333
                       3333

                      Program 31: To print the pattern of stars in decreasing order in the form of triangle.

                          Program31.py
                       File  Edit  Format    Run   Options   Window    Help

                       #Program to create star pattern

                       for i in range(10, 0, -1):
                           print("*"*i)

                          Output

                       **********
                       *********
                       ********
                       *******
                       ******
                       *****
                       ****
                       ***
                       **
                       *

                      124   Premium Edition-VII

| 121 122 123 124 125 126 127 128 129 130 131 |