PY
py
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
# Example of Python code to
# print some simple symmetric shapes
# using "X" and spaces..
def xprint(x, line_width=40):
spaces = (line_width - x) // 2
print(" " * spaces + "X" * x +
" " * spaces)
# Some simple shapes
shapes = {
"square": (0, 10, 10, 10, 10, 10, 10, 10,
10, 10, 10, 0),
"triangle": (0, 1, 3, 5, 7, 9, 11, 13, 15,
17, 19, 0),
"diamond": (0, 1, 3, 5, 7, 9, 11, 13, 15,
15, 13, 11, 9, 7, 5, 3, 1, 0),
"sandglass": (0, 15, 13, 11, 9, 7, 5, 3,
3, 5, 7, 9, 11, 13, 15, 0),
"cross": (0, 10, 10, 10, 30, 30, 30, 10,
10, 10, 0),
Enter to Rename, Shift+Enter to Preview
OUTPUT
Run