MCPcopy Create free account
hub / github.com/asweigart/PythonStdioGames / displayOutlineDiamond

Function displayOutlineDiamond

src/gamesbyexample/diamonds.py:25–38  ·  view source on GitHub ↗
(size)

Source from the content-addressed store, hash-verified

23
24
25def displayOutlineDiamond(size):
26 # Display the top half of the diamond:
27 for i in range(size):
28 print(' ' * (size - i - 1), end='') # Left side space.
29 print('/', end='') # Left side of diamond.
30 print(' ' * (i * 2), end='') # Interior of diamond.
31 print('\\') # Right side of diamond.
32
33 # Display the bottom half of the diamond:
34 for i in range(size):
35 print(' ' * i, end='') # Left side space.
36 print('\\', end='') # Left side of diamond.
37 print(' ' * ((size - i - 1) * 2), end='') # Interior of diamond.
38 print('/') # Right side of diamond.
39
40
41def displayFilledDiamond(size):

Callers 1

mainFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected