-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathExercise30.py
More file actions
44 lines (35 loc) · 985 Bytes
/
Copy pathExercise30.py
File metadata and controls
44 lines (35 loc) · 985 Bytes
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
def drawBox(size: int):
"""
Draw a 3D Box
:param size: Contains an integer for the width, length and height of the box
:type size: int
:raise TypeError: If size is not an int
:return: None
:rtype: None
"""
if size < 1:
return
# Print Top Layer
print(f" " * (size + 1), end="")
print(f"+" + "-" * (size * 2) + "+")
# Print Next Layer
for n in range(size):
print(f" " * (size - n), end="")
print(f"/" + " " * (size * 2) + "/", end="")
print(f" " * n + "|")
# Print Next Next Layer
print(f"+" + "-" * (size * 2) + "+", end="")
print(f" " * size + "+")
# Print Next Next Next Layer
for m in range(size):
# print(f" " * (size - n), end="")
print(f"|" + " " * (size * 2) + "|", end="")
print(f" " * (size - (m + 1)) + "/")
# Print Last Layer
print(f"+" + "-" * (size * 2) + "+")
...
drawBox(1)
drawBox(2)
drawBox(3)
drawBox(4)
drawBox(5)