Patterns


Pattern 1
 * * * * *
 * * * * *
 * * * * *
 * * * * *
 * * * * *

Code:
for i in range(1,6):
    for j in range(1,6):
        print('*',end='')
    print('')
 
Pattern 2 
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  
Code:  
for i in range(1,6):
    for j in range(1,6):
        print(i,end='')
    print(''
 
 Pattern 3
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
Code: 
 for i in range(1,6):
    for j in range(1,6):
        print(j,end='')
    print('')
 
  Pattern 4
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
Code: 
for i in range(65,69+1):
    for j in range(1,6):
        print(chr(i),end='')
    print('')

 
Pattern 5 
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
Code: 
for i in range(1,6):
    for j in range(65,70):
        print(chr(j),end='')
    print('')
 

Pattern 6 
*
* *
* * *
* * * *
* * * * *
Code: 
for i in range(1, 6):
    for j in range(1, i+1):
        print('*', end='')
    print('')
 
 Pattern 7 
1
2 2
3 3 3
4 4 4 4
5 5 5 5 5
Code:
for i in range(1, 6):
    for j in range(1, i+1):
        print(i, end='')
    print('')
 
Pattern 8 
1
1 2
1 2 3
1 2 3 4
1 2 3 4 5 
Code: 
for i in range(1, 6):
    for j in range(1,i+1):
        print(j,end='')
    print('')
 
Pattern 9 
A
B B
C C C
D D D D
E E E E E
Code:  
for i in range(65, 69 + 1):
    for j in range(65, i+1):
        print(chr(i), end='')
    print('')
 

Pattern 10 
A
A B 
A B C
A B C D
A B C D E
Code: 
for i in range(65, 70):
    for j in range(65, i+1):
        print(chr(j), end='')
    print('')

 
Pattern 11 
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
Code:  
for i in range(5, 0, -1):
    for j in range(1, 6):
        print(i, end='')
    print('')
  
 Pattern 12
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
Code: 
for i in range(1, 6):
    for j in range(5, 0, -1):
        print(j, end='')
    print('')
  
Pattern 13 
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
Code:  
for i in range(1, 6):
    for j in range(69, 64, -1):
        print(chr(j), end='')
    print(''
 
Pattern 14
*****
****
***
**
*
Code:
for i in range(1, 5+1):
    for j in range(5,i-1,-1):
        print('*',end='')
    print('')


Pattern 15
55555
4444
333
22
1Code:
for i in range(5, 0, -1):
    for j in range(1, i+1):
        print(i, end='')
    print('')

Pattern 16
54321
5432
543
54
5
Code:
for i in range(1, 6):
    for j in range(5, i-1, -1):
        print(j, end='')
    print('')
 
 
Pattern 17
111112222
333
44
5
Code:
for i in range(1, 6):
    for j in range(5, i-1, -1):
        print(i, end='')
    print('')
 
Pattern 18
12345
1234
123
12
1
Code:
for i in range(5, 0, -1):
    for j in range(1, i+1):
        print(j ,end='')
    print('')
 
Pattern 19
AAAAA
BBBB
CCC
DD
E
Code:
for i in range(65, 70):
    for j in range(70, i, -1):
        print(chr(i), end='')
    print('') 
 
 
Pattern 20
 
ABCDE
ABCD
ABC
AB
A
Code:
for i in range(70, 65, -1):
    for j in range(65, i):
        print(chr(j), end='')
    print('')

No comments:

Post a Comment