From e56c62e4337bd909426caee888f98272dc48612c Mon Sep 17 00:00:00 2001 From: Ansan P Sam <43809270+ansanpsam710@users.noreply.github.com> Date: Thu, 22 Oct 2020 23:20:23 +0530 Subject: [PATCH] Create ansanpsam710 --- contribution/ansanpsam710 | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 contribution/ansanpsam710 diff --git a/contribution/ansanpsam710 b/contribution/ansanpsam710 new file mode 100644 index 00000000..d838867e --- /dev/null +++ b/contribution/ansanpsam710 @@ -0,0 +1,30 @@ +# Python 3.x code to demonstrate star pattern + +# Function to demonstrate printing pattern of numbers +def numpat(n): + + # initialising starting number + num = 1 + + # outer loop to handle number of rows + for i in range(0, n): + + # re assigning num + num = 1 + + # inner loop to handle number of columns + # values changing acc. to outer loop + for j in range(0, i+1): + + # printing number + print(num, end=" ") + + # incrementing number at each column + num = num + 1 + + # ending line after each row + print("\r") + +# Driver code +n = 5 +numpat(n)