0% found this document useful (0 votes)
14 views2 pages

Python Pattern Printing Examples

The document contains multiple Python code snippets for pattern programming. Each snippet demonstrates different patterns using loops, including printing stars, numbers, and letters in various formats. The examples illustrate how to use nested loops to create structured outputs based on user input.

Uploaded by

depotonion
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)
14 views2 pages

Python Pattern Printing Examples

The document contains multiple Python code snippets for pattern programming. Each snippet demonstrates different patterns using loops, including printing stars, numbers, and letters in various formats. The examples illustrate how to use nested loops to create structured outputs based on user input.

Uploaded by

depotonion
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

Pattern programming

16 August 2025 19:05

n = int(input('Enter num: '))


for i in range(1,n+1):
for space in range(1,n+1-i):
print(' ',end='')
for star in range(1,i+1):
print('X',end=' ')
print()

n = int(input('Enter num: '))


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

n=int(input('--> '))
for i in range(1,n+1):
for j in range(1,i+1):
print(j,end=" ")
New Section 2 Page 1
print(j,end=" ")
print()

n = int(input("Enter num: "))


for i in range(1,n+1):
k = ord('A')
for j in range(1,n+1):
if i<=j:
print(chr(k),end=' ')
k+=1
else:
print(' ',end=' ')
print()

New Section 2 Page 2

You might also like