68
\$\begingroup\$

Given no input, your task is to generate the following:

a
 b
  c
   d
    e
     f
      g
       h
        i
         j
          k
           l
            m
             n
              o
               p
                q
                 r
                  s
                   t
                    u
                     v
                      w
                       x
                        y
                         z

Nonvisually, your task is to generate each letter in the alphabet, with spaces before it equal to its position in the alphabet minus one.

If you print this, it must appear like the above. Extraneous whitespace that does not affect appearance, as well as a trailing newline, is allowed. You can use all lowercase, or all uppercase.

You may also return this from a function as per usual rules, either as a string with newlines, or a list of strings.

This is , so shortest answer in bytes wins!

\$\endgroup\$
  • \$\begingroup\$ Do the spaces need to be real ASCII spaces, or can I give output like a<VERTICAL-TAB>b<VERTICAL-TAB>c...? How about if there are some backspace characters in there too? As long as the visual result is the same? \$\endgroup\$ – Digital Trauma Jun 8 '17 at 23:30
  • \$\begingroup\$ @DigitalTrauma as long as it appears the same, I don't care what kind of whitespace you use. \$\endgroup\$ – Stephen Jun 8 '17 at 23:31
  • \$\begingroup\$ Can I use tabs instead of spaces? \$\endgroup\$ – user69335 Jun 9 '17 at 23:28
  • \$\begingroup\$ @yamboy1 hmm, probably not. Most tabs are set to a large number of spaces - if your diagonal looks like it has 4 spaces before the b, it won't look very diagonal. If it looks like the slope is ~-1 then it's fine. \$\endgroup\$ – Stephen Jun 9 '17 at 23:32
  • \$\begingroup\$ does not affecting appearance include having an extra leading space or 2? \$\endgroup\$ – MildlyMilquetoast Sep 11 '17 at 17:08

154 Answers 154

1 2 3 4 5
6
1
\$\begingroup\$

Python 3 43 Bytes

for i in range(26):print(" "*i+chr(i+97))
| improve this answer | |
\$\endgroup\$
1
\$\begingroup\$

Aheui (esotope), 183 bytes (65 chars; 59 Hangul, 6 ASCII)

발밦다빠따반두발따받타빠싺싻삮타빠바파자초
분벋서썩떠번벌또여cbtp어또벓범석터번벋
타타빠싹빠싺밨볺아멓히셕처오져퍼서써섟뻐서

Try it online!


"cbtp" in the middle of the code is just an abbreviation of my nickname, which is ignored by the interpreter and reduce 8 bytes by using ASCII, not Hangul.

| improve this answer | |
\$\endgroup\$
1
\$\begingroup\$

Pushy, 10 bytes

`a\0x1A;`:"32}h

Where \0x1A is the character 26, 'SUB'

Try it online!

| improve this answer | |
\$\endgroup\$
1
\$\begingroup\$

Rockstar, 55 bytes

X's0
while X-26
cast X+97 into C
say " "*X+C
build X up

Try it here (Code will need to be pasted in)

| improve this answer | |
\$\endgroup\$
1 2 3 4 5
6

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.