Madad karo bhaiyo. Python - 3 star patterns of your choice
Answers
Answered by
1
Heya friend,
Here are the 3 star patterns :
Pattern 1
SOURCE CODE
# Star pattern 1
n = int(input('Enter the number of lines:'))
for i in range (1,n+1) :
for j in range (1,i+1) :
print('*',end='')
print()
OUTPUT
Enter the number of lines: 7
*
**
***
****
*****
******
*******
>>>
==========================================
Pattern 2
SOURCE CODE
# Star pattern 2
n = int(input('Enter the number of lines:'))
for i in range (n,0,-1):
for j in range(1,i+1):
print('*',end='')
print()
OUTPUT
Enter the number of lines: 10
**********
*********
********
*******
******
*****
****
***
**
*
>>>
==========================================
Pattern 3
SOURCE CODE
# Star pattern 3
n = int(input('Enter the number of lines:'))
for i in range (1,n+1):
for j in range(1,n-i+1):
print(' ',end='')
for k in range(1,i+1):
print('*',end='')
print()
OUTPUT
Enter the number of lines: 10
*
**
***
****
*****
******
*******
********
*********
**********
>>>
ThAnKs !
#BAL #answerwithquality
@MANAV
Similar questions