Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- """
- diamond.py
- This program prints repeating diamonds:
- O
- OOO
- OOOOO
- OOOOOOO
- OOOOOOOOO
- OOOOOOOOOOO
- OOOOOOOOO
- OOOOOOO
- OOOOO
- OOO
- O
- """
- # Experiment with changing these CONSTANT variable values:
- SIZE = 15
- DIAMOND_CHAR = 'O'
- while True:
- oCount = 1
- spaceCount = SIZE
- # Print the top half of the diamond:
- while spaceCount > 0:
- print(' ' * spaceCount + DIAMOND_CHAR * oCount)
- oCount = oCount + 2
- spaceCount = spaceCount - 1
- # Print the bottom half of the diamond:
- while oCount >= 1:
- print(' ' * spaceCount + DIAMOND_CHAR * oCount)
- oCount = oCount - 2
- spaceCount = spaceCount + 1
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement