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 306abd0 commit 6a3177dCopy full SHA for 6a3177d
patterns/Pattern-I.py
@@ -0,0 +1,41 @@
1
+__author__ = 'Avinash'
2
+
3
4
+# Python3 program to print alphabet pattern I
5
+'''
6
+* * * * * * * * *
7
+ *
8
9
10
11
12
13
14
15
16
17
18
+def print_pattern(n):
19
+ # Outer for loop for number of rows
20
+ for rows in range(n):
21
22
+ # Inner for loop columns
23
+ for columns in range(n):
24
25
+ # prints first and last row
26
+ if ((rows == 0 or rows == n-1) or
27
+ # prints middle column
28
+ (columns == n // 2)
29
+ ):
30
+ print("*", end=" ")
31
+ else:
32
+ print(" ", end=" ")
33
+ print()
34
35
36
+size = int(input("Enter size: \t"))
37
38
+if size < 8:
39
+ print("Enter a size greater than 8")
40
+else:
41
+ print_pattern(size)
0 commit comments