Skip to content

Instantly share code, notes, and snippets.

@neizod
Forked from Python1Liners/LICENSE.txt
Created July 28, 2012 15:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save neizod/3193822 to your computer and use it in GitHub Desktop.
Save neizod/3193822 to your computer and use it in GitHub Desktop.
Letter A
'\n'.join(' ' * (11 - i) + ' '.join(' ' if 1 < j < i - 2 and i in (5, 6, 7, 10, 11) else '*' for j in range(i)) for i in range(1, 12))

Letter A

Just draw letter "A" on 21x11 chars box. (Deriving from popular Pyramid's programming exercise).

Output

          *
         * *
        * * *
       * * * *
      * *   * *
     * *     * *
    * *       * *
   * * * * * * * *
  * * * * * * * * *
 * *             * *
* *               * *
'\n'.join(
' ' * (11 - i) + # make letter lean
' '.join(
' ' # don't draw * if:
if 1 < j < i - 2 and # check as not border of letter A, and
i in (5, 6, 7, 10, 11) else # check as not inner mid-bar of letter A
'*' # draw * otherwise
for j in range(i))
for i in range(1, 12))
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2012 Nattawut Phetmak <http://about.me/neizod>
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. You just DO WHAT THE FUCK YOU WANT TO.
{
"name": "letter_A",
"description": "draw letter A on 21x11 chars box.",
"keywords": [
"ascii art",
"letter"
]
}
print('\n'.join(' ' * (11 - i) + ' '.join(' ' if 1 < j < i - 2 and i in (5, 6, 7, 10, 11) else '*' for j in range(i)) for i in range(1, 12)))
# result:
# *
# * *
# * * *
# * * * *
# * * * *
# * * * *
# * * * *
# * * * * * * * *
# * * * * * * * * *
# * * * *
# * * * *
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment