Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create ansanpsam710 #629

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
37 changes: 37 additions & 0 deletions contribution/ansanpsam710
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@

edit
play_arrow

brightness_4
# Python 3.x code to demonstrate star pattern

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

# number of spaces
k = 2*n - 2

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

# inner loop to handle number spaces
# values changing acc. to requirement
for j in range(0, k):
print(end=" ")

# decrementing k after each loop
k = k - 2

# 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
pypart2(n)