0% found this document useful (0 votes)
13 views5 pages

Pattern Programs Part 1

The document contains a series of Python programs for generating various patterns based on user input for the number of rows. Each pattern demonstrates different arrangements of characters, numbers, or symbols, including stars, integers, and letters. The patterns range from simple repetitions to more complex sequences, showcasing basic programming concepts in Python.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
13 views5 pages

Pattern Programs Part 1

The document contains a series of Python programs for generating various patterns based on user input for the number of rows. Each pattern demonstrates different arrangements of characters, numbers, or symbols, including stars, integers, and letters. The patterns range from simple repetitions to more complex sequences, showcasing basic programming concepts in Python.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 5

Leela Soft Python Patterns Madhu

Pattern Programs
'''
Pattern-1:
* * * * *
* * * * *
* * * * *
* * * * *
* * * * * '''
n = int(input("Enter the number of rows: "))
for i in range(1, n + 1):
print("* "*n)

'''
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
'''

n = int(input("Enter the number of rows: "))


for i in range(1, n + 1):
for j in range(1, n + 1):
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
'''

n = int(input("Enter the number of rows: "))


for i in range(1, n + 1):
for j in range(1, n + 1):
print(j, end=" ")
print()

www.leelasoft.com Cell: 78 42 66 47 66
Leela Soft Python Patterns Madhu

'''
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
'''

n = int(input("Enter the number of rows: "))


for i in range(1, n + 1):
for j in range(1, n + 1):
print(chr(64 + 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
'''

n = int(input("Enter the number of rows: "))


for i in range(1, n + 1):
for j in range(1, n + 1):
print(chr(64 + j), end=" ")
print()

'''
Pattern-6:
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
'''

n = int(input("Enter the number of rows: "))


for i in range(1, n + 1):
for j in range(1, n + 1):
print(n + 1 - i, end=" ")
print()

www.leelasoft.com Cell: 78 42 66 47 66
Leela Soft Python Patterns Madhu

'''
Pattern-7:
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
'''

n = int(input("Enter the number of rows: "))


for i in range(1, n + 1):
for j in range(1, n + 1):
print(n + 1 - j, end=" ")
print()

'''
Pattern-8:
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
'''

n = int(input("Enter the number of rows: "))


for i in range(1, n + 1):
for j in range(1, n + 1):
print(chr(65 + n - i), end=" ")
print()

'''
Pattern-9:
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
'''

n = int(input("Enter the number of rows: "))


for i in range(1, n + 1):
for j in range(1, n + 1):
print(chr(65 + n - j), end=" ")
print()

www.leelasoft.com Cell: 78 42 66 47 66
Leela Soft Python Patterns Madhu

'''
Pattern-10:
*
* *
* * *
* * * *
* * * * *
'''
# Case - 1:
n = int(input("Enter the number of rows:"))
for i in range(1, n + 1):
for j in range(1, i + 1):
print("*", end=" ")
print()

#Case - 2:
n=int(input("Enter the number of rows:"))
for i in range(1,n+1):
print("* "*i)

'''
Pattern-11:
1
2 2
3 3 3
4 4 4 4
5 5 5 5 5
'''

n=int(input("Enter the number of rows: "))


for i in range(1,n+1):
for j in range(1,i+1):
print(i,end=" ")
print()

'''
Pattern-12:
1
1 2
1 2 3
1 2 3 4
1 2 3 4 5
'''

www.leelasoft.com Cell: 78 42 66 47 66
Leela Soft Python Patterns Madhu

n = int(input("Enter the number of rows: "))


for i in range(1, n + 1):
for j in range(1, i + 1):
print(j, end=" ")
print()

'''
Pattern-13:
A
B B
C C C
D D D D
E E E E E
'''

n = int(input("Enter the number of rows: "))


for i in range(1, n + 1):
for j in range(1, i + 1):
print(chr(64 + i), end=" ")
print()

'''
Pattern-14:
A
A B
A B C
A B C D
A B C D E
'''

n = int(input("Enter the number of rows: "))


for i in range(1, n + 1):
for j in range(1, i + 1):
print(chr(64 + j), end=" ")
print()

www.leelasoft.com Cell: 78 42 66 47 66

You might also like