FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
Basic-Programs-Python/Programs/double_arrow_pattern.py at master · Akshara604/Basic-Programs-Python · GitHub
Akshara604
/
Basic-Programs-Python
Public
forked from
Akshu-on-github/Basic-Programs-Python
Notifications
You must be signed in to change notification settings
Fork
0
Star
0
Code
Pull requests
0
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
Basic-Programs-Python
/
Programs
/
double_arrow_pattern.py
Copy path
More file actions
More file actions
Latest commit
History
History
History
75 lines (58 loc) · 1.71 KB
Breadcrumbs
Basic-Programs-Python
/
Programs
/
double_arrow_pattern.py
Copy path
File metadata and controls
75 lines (58 loc) · 1.71 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
# Python3 implementation of the approach
# Function to print the requried pattern
def
drawPattern
(
N
) :
n
=
N
;
row
=
1
;
# 'nst' is the number of values
nst
=
1
;
# 'nsp' is the number of spaces
nsp1
=
n
-
1
;
nsp2
=
-
1
;
val1
=
row
;
val2
=
1
;
while
(
row
<=
n
) :
# Here spaces are printed
# 'csp' is the count of spaces
csp1
=
1
;
while
(
csp1
<=
nsp1
) :
print
(
" "
,
end
=
" "
);
csp1
=
csp1
+
1
;
# Now, values are printed
# 'cst' is the count of stars
cst1
=
1
;
while
(
cst1
<=
nst
) :
print
(
val1
,
end
=
" "
);
val1
=
val1
-
1
;
cst1
=
cst1
+
1
;
# Again spaces have to be printed
csp2
=
1
;
while
(
csp2
<=
nsp2
) :
print
(
" "
,
end
=
" "
);
csp2
=
csp2
+
1
;
# Again values have to be printed
if
(
row
!=
1
and
row
!=
n
) :
cst2
=
1
;
while
(
cst2
<=
nst
) :
print
(
val2
,
end
=
" "
);
val2
=
val2
+
1
;
cst2
=
cst2
+
1
;
print
()
# Move to the next row
if
(
row
<=
n
//
2
) :
nst
=
nst
+
1
;
nsp1
=
nsp1
-
2
;
nsp2
=
nsp2
+
2
;
val1
=
row
+
1
;
val2
=
1
;
else
:
nst
=
nst
-
1
;
nsp1
=
nsp1
+
2
;
nsp2
=
nsp2
-
2
;
val1
=
n
-
row
;
val2
=
1
;
row
=
row
+
1
;
# Driver code
if
__name__
==
"__main__"
:
# Number of rows
N
=
7
;
drawPattern
(
N
);
Back
|
FazBrowse Home
|
New Git URL