From 83f30e2228aa99e26cb67205c72849432c219b70 Mon Sep 17 00:00:00 2001 From: Ansan P Sam <43809270+ansanpsam710@users.noreply.github.com> Date: Thu, 22 Oct 2020 23:17:49 +0530 Subject: [PATCH] Create ansanpsam710 --- contribution/ansanpsam710 | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 contribution/ansanpsam710 diff --git a/contribution/ansanpsam710 b/contribution/ansanpsam710 new file mode 100644 index 00000000..870daa0e --- /dev/null +++ b/contribution/ansanpsam710 @@ -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)