write a program to print pyramid pattern in python

# python code to print pyramid pattern in python
 def pyramid(n):
	
	
	k = n - 1

	for i in range(0, n):
	

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

			print("* ", end="")
	

		print("\r")

 n = 5
 pyramid(n)


 Output

    *
   * *
  * * *
 * * * *
* * * * *

My Thought

Your email address will not be published. Required fields are marked *

Our Tool : hike percentage calculator