Skip to content
This repository has been archived by the owner on Nov 10, 2021. It is now read-only.

Create pyramid.py #552

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions Patterns/pyramid.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Python 3.x code to demonstrate star pattern

# Function to demonstrate printing pattern
def pypart(n):

# outer loop to handle number of rows
# n in this case
for i in range(0, n):

# inner loop to handle number of columns
# values changing acc. to outer loop
for j in range(0, i+1):

# printing stars
print("* ",end="")

# ending line after each row
print("\r")

# Driver Code
n = 5
pypart(n)