June 2021
Beginner
432 pages
9h 9m
English
This program features a small algorithm for drawing ASCII-art diamonds of various sizes. It contains functions for drawing either an outline or filled-in-style diamond of the size you dictate. These functions are good practice for a beginner; try to understand the pattern behind the diamond drawings as they increase in size.
When you run diamonds.py, the output will look like this:
Diamonds, by Al Sweigart al@inventwithpython.com
/\
\/
/\
\/
/\
/ \
\ /
\/
/\
//\\
\\//
\/
/\
/ \
/ \
\ /
\ /
\/
/\
//\\
///\\\
\\\///
\\//
\/
--snip--
A helpful approach to creating this program yourself is to “draw” ...
Read now
Unlock full access