Page 144 - Touchpad_Plus_V3.2_Class 8
P. 144
Program 11: To print the pattern of stars in decreasing order in the form of triangle.
**********
*********
********
*******
******
*****
****
***
**
*
Output
**********
*********
Program11.py ********
File Edit Format Run Options Window Help *******
******
*****
#Program to create star pattern
****
***
for i in range(10, 0, -1): **
print("*"*i) *
Restart
Looping statements are very useful and necessary for developing applications.
The for statement executes a simple or compound statement for a fixed number of times.
The range( ) function is an in-built function of Python.
The while statement executes a set of statements repeatedly, until the logical expression
evaluates to true.
The break keyword in Python is used for bringing the program control out of the loop.
When a continue statement is encountered inside a loop, control of the program jumps
to the beginning of the loop for next iteration, skipping the execution of rest of the
statements of the loop for the current iteration.
142 Plus (Ver. 3.2)-VIII

