We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent da1cc4e commit 4c2508eCopy full SHA for 4c2508e
Pattern.py
@@ -0,0 +1,30 @@
1
+# Python 3.x code to demonstrate star pattern
2
+
3
+# Function to demonstrate printing pattern of numbers
4
+def numpat(n):
5
6
+ # initialising starting number
7
+ num = 1
8
9
+ # outer loop to handle number of rows
10
+ for i in range(0, n):
11
12
+ # re assigning num
13
14
15
+ # inner loop to handle number of columns
16
+ # values changing acc. to outer loop
17
+ for j in range(0, i+1):
18
19
+ # printing number
20
+ print(num, end=" ")
21
22
+ # incrementing number at each column
23
+ num = num + 1
24
25
+ # ending line after each row
26
+ print("\r")
27
28
+# Driver code
29
+n = 5
30
+numpat(n)
0 commit comments