Page 77 - TP_V5.1_C8_fb
P. 77
SOME MORE PROGRAMS
Program 7: To create a number pattern using for loop.
Program7.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)
You will get the following output:
Output
3
33
333
3333
Program 8: To print the pattern of stars in decreasing order in the form of triangle.
Program8.py
File Edit Format Run Options Window Help
#Program to create star pattern
for i in range(10, 0, -1):
print("*"*i)
You will get the following output:
Output
**********
*********
********
*******
******
*****
****
***
**
*
Iterations in Python 75

