FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
python_Projects/Diamonds.py at main · kalebleeroy13/python_Projects · GitHub
kalebleeroy13
/
python_Projects
Public
Notifications
You must be signed in to change notification settings
Fork
0
Star
0
Code
Issues
0
Pull requests
0
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
python_Projects
/
Diamonds.py
Copy path
More file actions
More file actions
Latest commit
History
History
History
30 lines (23 loc) · 859 Bytes
Breadcrumbs
python_Projects
/
Diamonds.py
Copy path
File metadata and controls
30 lines (23 loc) · 859 Bytes
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
def
main
():
print
(
'Rectangle pattern'
)
# Display rectangles of different sizes:
for
width
,
height
in
[(
6
,
3
), (
10
,
4
), (
12
,
5
)]:
displayOutLineRectangle
(
width
,
height
)
print
()
# Prints newline
displayFilledRectangle
(
width
,
height
)
print
()
# Prints newline
def
displayOutLineRectangle
(
width
,
height
):
# displays the top half of rectangle:
print
(
'+'
+
'-'
*
(
width
-
2
)
+
'+'
)
# Display sides of rectangle:
for
_
in
range
(
height
-
2
):
print
(
'|'
+
' '
*
(
width
-
2
)
+
'|'
)
# Display bottom of rectangle
print
(
'+'
+
'-'
*
(
width
-
2
)
+
'+'
)
def
displayFilledRectangle
(
width
,
height
):
# Display filled rectangles:
for
_
in
range
(
height
):
print
(
'#'
*
width
)
# if this program was run (instead of imported), run the game:
if
__name__
==
'__main__'
:
main
()
Back
|
FazBrowse Home
|
New Git URL