for i in range(5):
for j in range(5):
print "*",
Output:
* * * * *
* * * * *
* * * * *
* * * * *
* * * * *
Pattern 2:
for i in range(1,6):
for j in range(1,6):
print i,
print
for j in range(1,6):
print i,
Output:1 1 1 1 1
2 2 2 2 2
3 3 3 3 3
4 4 4 4 4
5 5 5 5 5
Pattern 3:
for i in range(1,6):
for j in range(1,6):
print j,
print
for j in range(1,6):
print j,
Output:
1 2 3 4 5
1 2 3 4 5
1 2 3 4 5
1 2 3 4 5
1 2 3 4 5
Pattern 4:
for i in range(65,70):
for j in range(65,70):
print chr(i),
print
Output:
A A A A A
B B B B B
C C C C C
D D D D D
E E E E E
Pattern 5:
for i in range(65,70):
for j in range(65,70):
print chr(j),
print
for j in range(65,70):
print chr(j),
Output:
A B C D E
A B C D E
A B C D E
A B C D E
A B C D E
Pattern 6:
for i in range(5,0,-1):
for j in range(1,6):
print i,
print
Output:
5 5 5 5 5
4 4 4 4 4
3 3 3 3 3
2 2 2 2 2
1 1 1 1 1
Pattern 7:
for i in range(5,0,-1):
for j in range(5,0,-1):
print j,
print
Output:
5 4 3 2 1
5 4 3 2 1
5 4 3 2 1
5 4 3 2 1
5 4 3 2 1
Pattern 8:
for i in range(69,64,-1):
for j in range(69,64,-1):
print chr(i),
print
Output:
E E E E E
D D D D D
C C C C C
B B B B B
A A A A A
Pattern 9:
for i in range(69,64,-1):
for j in range(69,64,-1):
print chr(j),
print
Output:
E D C B A
E D C B A
E D C B A
E D C B A
E D C B A
Pattern 10:
for i in range(1,6):
for j in range(1,i+1):
print '*',
print
Output:
*
* *
* * *
* * * *
* * * * *
Pattern 11:
for i in range(1,6):
for j in range(1,i+1):
print i,
print
Output:
1
2 2
3 3 3
4 4 4 4
5 5 5 5 5
Pattern 12:
for i in range(1,6):
for j in range(1,i+1):
print j,
print
for j in range(1,i+1):
print j,
Output:
1
1 2
1 2 3
1 2 3 4
1 2 3 4 5
Pattern 13:
Pattern 14:
Pattern 15:
Pattern 16:
Pattern 17:
Pattern 18:
Pattern 19:
Pattern 20:
Pattern 21:
Pattern 22:
Pattern 23:
Pattern 24:
Pattern 25:
for i in range(65,70):
for j in range(65,i+1):
print chr(i),
print
Output:
A
B B
C C C
D D D D
E E E E E
for i in range(65,70):
for j in range(65,i+1):
print chr(j),
print
Output:
A
A B
A B C
A B C D
A B C D E
for i in range(1,6):
for j in range(6,i,-1):
print '*',
print
Output:
* * * * *
* * * *
* * *
* *
*
for i in range(1,6):
for j in range(6,i,-1):
print i,
print
Output:
1 1 1 1 1
2 2 2 2
3 3 3
4 4
5
for i in range(1,6):
for j in range(5,i-1,-1):
print j,
print
Output:
5 4 3 2 1
5 4 3 2
5 4 3
5 4
5
for i in range(5):
for j in range(5,i,-1):
print chr(i+65),
print
Output:
A A A A A
B B B B
C C C
D D
E
for i in range(5,0,-1):
for j in range(0,i):
print chr(j+65),
print
Output:
A B C D E
A B C D
A B C
A B
A
for i in range(5,0,-1):
for j in range(1,i+1):
print i,
print
Output:
5 5 5 5 5
4 4 4 4
3 3 3
2 2
1
for i in range(1,6):
for j in range(5,i-1,-1):
print j,
print
Output:
5 4 3 2 1
5 4 3 2
5 4 3
5 4
5
for i in range(4,-1,-1):
for j in range(0,i+1):
print chr(i+65),
print
Output:
E E E E E
D D D D
C C C
B B
A
for i in range(5):
for j in range(4,i-1,-1):
print chr(j+65),
print
Output:
E D C B A
E D C B
E D C
E D
E
a=1
for i in range(5):
for j in range(4,i-1,-1):
print " ",
for k in range(1,a+1):
print "*",
a+=1
print
Output:
*
* *
* * *
* * * *
* * * * *
a=1
for i in range(1,6):
for j in range(4,i-1,-1):
print " ",
for k in range(1,a+1):
print i,
a+=1
print
Output:
1
2 2
3 3 3
4 4 4 4
5 5 5 5 5
0 comments:
Post a Comment