Make star pattern in Python | ( n ) Numbers of lines


  • Let's see this code in this code we make n: this is the numbers of line to make how many lines in a star pattern

  • Now we need a repeated line of code so that we put for loop and its range 0 to n( n numbers of line  to make star)

  • The second for loop is said that the next line code we make one more star i+1

  • And last what we print (*) & end is empty

  • Copy this code to the right-top corner and past your python compiler.

  • Then you see a pattern


Source Code : 

'''
Here We write a program to print star pattern as follows 
*
**
***
****
*****
'''
n = int(input( " Enter the number of lines:"))

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

Video with Implementation :