8000
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 6a3177d commit 4c180eaCopy full SHA for 4c180ea
patterns/Pattern-J.py
@@ -0,0 +1,42 @@
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 column
26
+ if (rows == 0 or
27
+ rows == n-1 and columns <= n//2 or
28
+ # prints middle row
29
+ (columns == n // 2)
30
+ ):
31
+ print("*", end=" ")
32
+ else:
33
+ print(" ", end=" ")
34
+ print()
35
36
37
+size = int(input("Enter size: \t"))
38
39
+if size < 8:
40
+ print("Enter a size greater than 8")
41
+else:
42
+ print_pattern(size)
0 commit comments