Class 4
Class 4
1 1
2 2 2 2
3 3 3 3 3 3
4 4 4 4 4 4 4 4
5 5 5 5 5 5 5 5 5 5
for i in range(5):
1
for j in range(i+1):
2 2
print(i+1, end=‘’)
3 33
print() 4 444
0
Step 1: 5 5555
i = 0, j = na 1 1
Step 2:
i = 1, j = 0 2 2 2
Step 3:
i = 2, j = 3 3 3 3
Step 4:
i=,j= 4 4 4 4 4
Wap to print the following pattern:
Input: 5
Output:
#
##
###
####
#####
Wap to print the following pattern:
Input: 5
Output:
1
12
123
1234
12345
Wap to print the following pattern:
Input: 5
Output:
1
33
555
7777
99999
1 1 1 1 1
Input: 5 Limit=5
Output: Num=1
for i in range (limit, 0, -1):
11111
for j in range(i):
2222 print(num, end=‘ ’)
333 print()
44 num+=1
5
Wap to print the following pattern:
Input: 5
Output:
55555
4444
333
22
1
Wap to print the following pattern:
Input: 5
Output:
1
12
123
1234
12345
HOMEWORK
Wap to print the following pattern:
Input: 5
Output:
1
21
321
4321
54321
Wap to print the following pattern:
Input: 5
Output:
54321
4321
321
21
1
Wap to print the following pattern:
Input: 5
Output:
12345
22345
33345
44445
55555
Wap to print the following multiplication
table:
Input: 5
Output:
1
2 4
3 6 9
4 8 12 16
5 10 15 20 25
6 12 18 24 30 36
7 14 21 28 35 42 49
8 16 24 32 40 48 56 64
Wap to print the following pattern:
Input: 5
Output:
*
**
***
****
*****
****
***
**
*