57
\$\begingroup\$

Your goal is to create an alphabet song as text in the following form (in order):

A is for <word starting with A>
B is for <word starting with B>
C is for <word starting with C>
...
Z is for <word starting with Z>

Example output:

A is for Apple
B is for Banana
C is for Carrot
D is for Door
E is for Elephant
F is for Frog
G is for Goat
H is for Hat
I is for Icicle
J is for Jelly
K is for Kangaroo
L is for Lovely
M is for Mom
N is for Never
O is for Open
P is for Paste
Q is for Queen
R is for Rice
S is for Star
T is for Test
U is for Underneath
V is for Very
W is for Water
X is for X-ray
Y is for Yellow
Z is for Zipper

Rules:

  • Each "letter" of the song has its own line, so there are 26 lines, and a possible trailing linefeed.

  • The output is case-sensitive:

    • The letter at the start of each line must be capitalized.
    • is for is lowercase.
    • The chosen word does not need to be capitalized, but may be. All lines should be consistent.
  • The chosen word for each line is up to you, but must be a valid English word with at least 3 letters, and it cannot be a conjunction (like and or but), interjection/exclamation (like hey or yay), abbreviation (like XLS), or a name (like Jon).

  • Though I doubt anyone would find it shorter, I'd find it acceptable to use a phrase instead of a single word. So if for some reason S is for Something smells fishy... is shorter, go for it.

  • Put your program's output in your answer, or at least the list of words you used (if there's a link to run your code online, we don't need to see the entire output).

  • Shortest code wins


This challenge was inspired by this video.

\$\endgroup\$
12
  • 2
    \$\begingroup\$ Given some of the answers, this song by Barenaked Ladies seems relevant. \$\endgroup\$ Commented Feb 8, 2017 at 19:21
  • 1
    \$\begingroup\$ @JonathanAllan No slang. Dictionaries contain a lot of things that aren't technically words. Abbreviations is one, slang is another. \$\endgroup\$
    – mbomb007
    Commented Feb 8, 2017 at 19:34
  • 4
    \$\begingroup\$ It's too bad that this devolved into finding 3 letter words that end in the same letter. \$\endgroup\$
    – 12Me21
    Commented Feb 9, 2017 at 0:33
  • 1
    \$\begingroup\$ @12Me21 how is that devolution, is this not code-golf?! If you can find a way to access longer words with fewer bytes just do it! Edit - Find a list of 3-letter words using a set of two middle letters and a set of two end letters and you can beat the single enders (which use a set of seven middles). \$\endgroup\$ Commented Feb 9, 2017 at 12:32
  • 1
    \$\begingroup\$ There's a couple of answers using an external dictionary. Shouldn't they have to add the size of that file to their code? \$\endgroup\$
    – pipe
    Commented Feb 9, 2017 at 15:30

37 Answers 37

62
\$\begingroup\$

Bash (+coreutils), 81, 87, 82, 78 bytes

Uses the man page for X, as the source of words.

Golfed

man xyst\  x|&grep -Po '\b[a-z]{4,} '|sed 's/\(.\)/\u\1 is for &/'|sort -uk1,1

EDITS

  • Used a non-existing 'xyst' man page + |& to save 5 bytes;
  • Saved 4 more bytes, by swapping sed and sort.

Test

%man xyst\  x|&grep -Po '\b[a-z]{4,} '|sed 's/\(.\)/\u\1 is for &/'|sort -uk1,1

A is for also 
B is for build 
C is for computing 
D is for distribution 
E is for entry 
F is for following 
G is for graphics 
H is for hierarchical 
I is for implementations 
J is for just 
K is for keyboard 
L is for listing 
M is for manual 
N is for network 
O is for output 
P is for programs 
Q is for quite 
R is for runs 
S is for system 
T is for transparent 
U is for used 
V is for various 
W is for window 
X is for xyst 
Y is for your 
Z is for zeros 
\$\endgroup\$
12
  • 3
    \$\begingroup\$ Are lsof and xregs words? :) \$\endgroup\$
    – AAM111
    Commented Feb 8, 2017 at 16:41
  • 1
    \$\begingroup\$ @OldBunny2800 should be fixed now \$\endgroup\$
    – zeppelin
    Commented Feb 8, 2017 at 17:12
  • 2
    \$\begingroup\$ I looked it up, and yes, xyst is a real word. :) \$\endgroup\$
    – AAM111
    Commented Feb 8, 2017 at 17:17
  • 4
    \$\begingroup\$ Looks like kids are gonna be learning some big words. :D \$\endgroup\$
    – mbomb007
    Commented Feb 8, 2017 at 17:25
  • 1
    \$\begingroup\$ @JonathanAllan Unfortunately, man page for "x" is not available on TIO, but here is a link tio.run/nexus/…, which uses "man man" instead. The trick with xyst is that man xyst will complain that there is "No manual entry for xyst" to the stderr, which is then merged into stdout with |&, so it can be grepped. \$\endgroup\$
    – zeppelin
    Commented Feb 9, 2017 at 11:50
36
\$\begingroup\$

Python 2, 88 77 bytes

-11 bytes thanks to xnor (avoid the zip by traversing the string and counting c up from 65)

c=65
for x in'niooaauusoioaiuaaoiineeaei':print'%c is for %c%st'%(c,c,x);c+=1

Try it online!

(A port of my Jelly answer, when it was 56 bytes.)

A is for Ant
B is for Bit
C is for Cot
D is for Dot
E is for Eat
F is for Fat
G is for Gut
H is for Hut
I is for Ist
J is for Jot
K is for Kit
L is for Lot
M is for Mat
N is for Nit
O is for Out
P is for Pat
Q is for Qat
R is for Rot
S is for Sit
T is for Tit
U is for Unt
V is for Vet
W is for Wet
X is for Xat
Y is for Yet
Z is for Zit
\$\endgroup\$
6
  • 5
    \$\begingroup\$ I like the method of words that end in t. The iteration can be shortened by updating x in parallel. \$\endgroup\$
    – xnor
    Commented Feb 8, 2017 at 19:59
  • \$\begingroup\$ Very smart, as ever; thanks! \$\endgroup\$ Commented Feb 8, 2017 at 20:09
  • 1
    \$\begingroup\$ What's Unt? Can't find that one anywhere \$\endgroup\$ Commented Feb 9, 2017 at 5:18
  • \$\begingroup\$ I don't think Unt is a word, but Ut is so you can replace the n in your literal with \0 to make this valid and only add on one more byte. Edit nevermind rules say it has to be 3 letters long... hmmm \$\endgroup\$ Commented Feb 9, 2017 at 5:20
  • 5
    \$\begingroup\$ @AlbertRenshaw An unt is a European Mole according to Merriam-Webster. An alternative would be ult according to Wiktionary it is not just an abbreviation (which are listed with periods, such as ult.). \$\endgroup\$ Commented Feb 9, 2017 at 5:34
31
\$\begingroup\$

Bash, 78, 69 bytes

Aardvarks, Babushkas and Kamikazes !

Golfed

sed -nr '/^[a-z]{9}$/s/(.)/\u\1 is for &/p'</u*/*/*/words|sort -uk1,1

EDITS

  • Got rid of grep, -9 bytes

Test

%sed -nr '/^[a-z]{9}$/s/(.)/\u\1 is for &/p'</u*/*/*/words|sort -uk1,1

A is for aardvarks
B is for babushkas
C is for cablecast
D is for dachshund
E is for eagerness
F is for fabricate
G is for gabardine
H is for habitable
I is for ibuprofen
J is for jabberers
K is for kamikazes
L is for labelling
M is for macaronis
N is for nailbrush
O is for obedience
P is for pacemaker
Q is for quadrants
R is for rabbinate
S is for sabotaged
T is for tableland
U is for ulcerated
V is for vacancies
W is for wackiness
X is for xylophone
Y is for yachtsman
Z is for zealously

Makes use of /usr/share/dict/words:

words is a standard file on all Unix and Unix-like operating systems, and is simply a newline-delimited list of dictionary words. It is used, for instance, by spell-checking programs.

\$\endgroup\$
0
14
\$\begingroup\$

PowerShell, 150 141 117 75 bytes

65..90|%{$i=[char]$_;"$i is for $i$('niooaauusoioaiuaaoiineeaei'[$_-65])t"}

Try it online!

Loops from 65 to 90 (i.e., ASCII A to Z). Each iteration, we turn the integer into the appropriate char (i.e., ASCII 65 for A), save that into $i for use later, string-concatenate that with is for $i, and then tack on the middle of the appropriate word. That's done by indexing into a lengthy string (borrowed from Jonathan Allan's answer). Finishes off with the letter t to make the three letter word.

The resulting strings are all left on the pipeline, and an implicit Write-Output at the end prints them with newlines in between.

Saved a bunch of bytes thanks to Rod
Borrowed wordlist from Jonathan Allan's answer

\$\endgroup\$
2
  • \$\begingroup\$ you can remove the first letter of each word (the capital one) and print with [char]$ example \$\endgroup\$
    – Rod
    Commented Feb 8, 2017 at 16:08
  • \$\begingroup\$ @Rod Thanks. I coupled that with what I was just working on to change how the loop is calculated and how the indexing is calculated and saved some more yet. \$\endgroup\$ Commented Feb 8, 2017 at 16:16
14
\$\begingroup\$

Jelly, 39 bytes

;“ẉbẊWS»,⁸K;;”t
“¤ṁp}œḊṄæ®’b6ị“ʠȷ»ØAç"Y

TryItOnline!

Based on the 56 byte version (two below), but changed words to remove all middle letter "u"s so it can index into the dictionary word "anisole"*, which has the convenience of having the letters we need all at indexes less than six: 1:a, 2:n 3:i, 4:s, 5:o (6:l), 0:e (note the "e" on the right is at index zero [also 7 and -7 and any other number congruent to 0 mod 7]). It's also early in the dictionary so has only a two rather than the much more common three byte lookup index ("anisogamete" would also work for 2).

* The old-school name for the aromatic ether methoxybenzene, often used in perfumes.

A is for Ant
B is for Bit
C is for Cot
D is for Dot
E is for Eat
F is for Fat
G is for Got
H is for Hat
I is for Ist
J is for Jot
K is for Kit
L is for Lot
M is for Mat
N is for Nit
O is for Oat
P is for Pat
Q is for Qat
R is for Rot
S is for Sit
T is for Tit
U is for Unt
V is for Vet
W is for Wet
X is for Xat
Y is for Yet
Z is for Zit

###How?

“¤ṁp}œḊṄæ®’b6ị“ʠȷ»ØAç"Y - Main link: no arguments
“¤ṁp}œḊṄæ®’             - base 250 compressed number -> 75711304811637630759
           b6           - convert to base 6 list
                          -> [           2  ,           3  ,           5  ,           5  ,           1  ,           1  ,           5  ,           1  ,           4  ,           5  ,           3  ,           5  ,           1  ,           3  ,           1  ,           1  ,           1  ,           5  ,           3  ,           3  ,           2  ,           0  ,           0  ,           1  ,           0  ,           3]
              “ʠȷ»      -     word from Jelly's dictionary, "anisole" 
             ị          - index into that
                          -> [          "n" ,          "i" ,          "o" ,          "o" ,          "a" ,          "a" ,          "o" ,          "a" ,          "s" ,          "o" ,          "i" ,          "o" ,          "a" ,          "i" ,          "a" ,          "a" ,          "a" ,          "o" ,          "i" ,          "i" ,          "n" ,          "e" ,          "e" ,          "a" ,          "e" ,          "i"]
                  ØA    - get the uppercase alphabet
                          -> [          "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"]
                    ç"  - zip with last Link (1) as a dyad (i.e. get [f("A", "n"), f("B", "i"), ...]
                          -> ["A is for Ant","B is for Bit","C is for Cot","D is for Dot","E is for Eat","F is for Fat","G is for Got","H is for Hat","I is for Ist","J is for Jot","K is for Kit","L is for Lot","M is for Mat","N is for Nit","O is for Oat","P is for Pat","Q is for Qat","R is for Rot","S is for Sit","T is for Tit","U is for Unt","V is for Vet","W is for Wet","X is for Xat","Y is for Yet","Z is for Zit"]
                      Y - join with line feeds
                        - implicit print

;“ẉbẊWS»,⁸K;;”t - Link 1, make a song line: character X; character Y
 “ẉbẊWS»        - compressed string = " is for"
;               - X (e.g. "A") concatenate that ->  "A is for"
        ,       - pair that with
         ⁸      - the left argument (X) ---------> ["A is for","A"]
          K     - join with spaces -------------->  "A is for A"
           ;    - concatenate with Y (e.g. "n") ->  "A is for An"
             ”t - literal character = "t"
            ;   - concatenate ------------------->  "A is for Ant"

Previous, 46

“¤ṪŻIð^ƥ’b4ị⁾sap⁾pt¤ØAż,@K¥€“ẉbẊWS»ØAżYF”e272¦

Words all have second letter "s" or "a" and last letter "p" or "t" using a base four lookup in a Cartesian product of "sa" and "pt". Except the "U" word, which the code changes to "Use" (using the relatively bulky F”e272¦ on the end) - if I could find a word list like this that does not have such an exception we'd be looking at 39 bytes.

Word list:

Asp, Bat, Cat, Dap, Eat, Fat, Gap, Hat, Ist, Jat, Kat, Lap, Mat, Nap, Oat, Pat, Qat, Rat, Sat, Tap, Use, Vat, Wat, Xat, Yap, Zap

try this one


###Previous 56 bytes

”tṁØA⁺,j“niooaauusoioaiuaaoiineeaei”œs3Z,@K¥€“ẉbẊWS»ØAżY

Word list:

Ant, Bit, Cot, Dot, Eat, Fat, Gut, Hut, Ist, Jot, Kit, Lot, Mat, Nit, Out, Pat, Qat, Rot, Sit, Tit, Unt, Vet, Wet, Xat, Yet, Zit

It is formatted, give it a go


###Previous, 83 bytes “ẉbẊWS»WṁØA⁺żż“¦ịfe$ɲVPġþ¹Øt@ƑƊŀqṁŒƑOɦ⁴ḍẊḤṁr}Ƭ¢b⁻?q&øIụNẎ9eƲi⁸'��B.;%V,¦İ⁷ẓk½»s5¤K€Y ...let's play "Spot which letter does not have an animal!" there is one, and only one - watch out for the red herring (a lie, the red herring was xenon, which is an element, obviously not an animal), are two five letter words here that are not animals (xenon being one):

Aphid, Bison, Camel, Dingo, Eagle, Finch, Gecko, Heron, Indri, Jabot, Koala, Lemur, Mouse, Nyala, Otter, Panda, Quail, Raven, Sloth, Tapir, Urial, Viper, Whale, Xenon, Yapok, Zebra

(of course this is formatted correctly, try it - I just thought I'd save space)

\$\endgroup\$
17
  • \$\begingroup\$ Xenon is not an animal. I was sure you were making a joke by having H is for Herring, but I guess not. \$\endgroup\$
    – mbomb007
    Commented Feb 8, 2017 at 17:34
  • \$\begingroup\$ Heh, it was a lie. Xenon was the obvious one :) \$\endgroup\$ Commented Feb 8, 2017 at 17:45
  • \$\begingroup\$ I think they are thinking of xenop, which is not in Jelly's dictionary. \$\endgroup\$ Commented Feb 8, 2017 at 17:54
  • \$\begingroup\$ Wonderful idea! But Uut? \$\endgroup\$ Commented Feb 8, 2017 at 18:04
  • \$\begingroup\$ @GregMartin I agree, I think you started devolving your words into syllabic grunts. \$\endgroup\$ Commented Feb 8, 2017 at 18:14
10
\$\begingroup\$

Retina, 89 87 bytes

Saved 2 bytes thanks to Martin Ender


ApBaCaDoEaFaGeHaIkaJeKiLeMeNeOpPeQaRaSaTiUniVaWeXysYurZi
[A-Z]
¶$& is for $&
^¶

m`$
t

Try it online!

I picked a word for each letter that ends in t (some are pretty obscure).

Explanation


ApBaCaDoEaFaGeHaIkaJeKiLeMeNeOpPeQaRaSaTiUniVaWeXysYurZi

Replace the non-existent (empty) input with the text above.

[A-Z]
¶$& is for $&

Replace each capital letter with (newline)(itself) is for (itself). This results in the text above being split into separate lines like

A is for Ap
B is for Ba
C is for Ca

... and so on

^¶
​

However, since the newline was placed before each capital, there is a leading newline that must be removed. It is removed in this stage.

m`$
t

Put a t at the end of every line, since every word used in the song ends in t.

\$\endgroup\$
4
  • \$\begingroup\$ You don't need to capture the upper case letter. Just use $& or $0 instead of $1. Actually that might also save bytes over my split stage. \$\endgroup\$ Commented Feb 8, 2017 at 18:03
  • \$\begingroup\$ @MartinEnder Thanks. What does $& do exactly? I didn't see it on the GitHub wiki. \$\endgroup\$ Commented Feb 8, 2017 at 18:15
  • \$\begingroup\$ It's an alias for $0 (and it's just part of the .NET flavour, as well as most other flavours). \$\endgroup\$ Commented Feb 8, 2017 at 18:21
  • \$\begingroup\$ Using some shorter words to get it down to 83, try it online \$\endgroup\$ Commented Feb 9, 2017 at 1:59
8
\$\begingroup\$

Retina, 92 88 bytes

Saved 4 bytes by borrowing an idea from Business Cat's answer.

Byte count assumes ISO 8859-1 encoding.


AddBCDEelFGHItsJetKitLMNetOilPQatRSTUrnVatWXisYesZit
[A-Z]
¶$& is for $&
m` .$
$&ad
G`.

Try it online!

Based on AdmBorkBork's word list, but I've changed a few more words into ones that end in ad to save more bytes on the common suffix.

Explanation


AddBCDEelFGHItsJetKitLMNetOilPQatRSTUrnVatWXisYesZit

Turn the empty (non-existent) input into this string. It contains all the letters as well as the rest of those words which don't end in ad.

[A-Z]
¶$& is for $&

Insert a linefeed before each upper case letter and then turn it into X is for X.

m` .$
$&ad

Match the letters which are now by themselves and append ad to complete the shortened words.

G`.

Discard the empty line that was created by inserting a linefeed before A.

\$\endgroup\$
0
7
\$\begingroup\$

05AB1E, 45 42 39 38 37 36 bytes

Au'Æå•à¡P°€kš¦zᮕSè)øvy¬“ÿ€ˆ€‡ ÿt“,

Try it online!

Explanation

Au pushes the uppercase alphabet.
'Æå pushes the word scenario.
•à¡P°€kš¦zᮕ pushes the base-10 number 36774474076746444766322426.
uses those digits to index into scenario.
zips those strings together into the list [An, Bi, Co, ..., Zi]

v                  # for each element in the list
 y                 # push it
  ¬                # push it's first letter
   “ÿ€ˆ€‡ ÿt“      # push the string "ÿ is for ÿt" 
                   # replacing ÿ with with the top element of the stack
             ,     # print with newline

Words used: ['Ant', 'Bit', 'Cot', 'Dot', 'Eat', 'Fat', 'Got', 'Hat', 'Ist', 'Jot', 'Kit', 'Lot', 'Mat', 'Nit', 'Oat', 'Pat', 'Qat', 'Rot', 'Sit', 'Tit', 'Unt', 'Vet', 'Wet', 'Xat', 'Yet', 'Zit']

33 byte version using some words I'm unsure about

Au'†Ž•4Ãðzòç•3BSè)øvy¬“ÿ€ˆ€‡ ÿt“,

Words: ['Ant', 'Bat', 'Cat', 'Dat', 'Eat', 'Fat', 'Gat', 'Hat', 'Ist', 'Jat', 'Kat', 'Lat', 'Mat', 'Nat', 'Oat', 'Pat', 'Qat', 'Rat', 'Sat', 'Tat', 'Ust', 'Vat', 'Wat', 'Xat', 'Yat', 'Zat']

\$\endgroup\$
1
  • \$\begingroup\$ -1 byte by changing the vy to for example ʒ (since we print, we can use the filter as a foreach). Since this answer is pretty old, the should now be øJ and the •à¡P°€kš¦zᮕ should be •V¢~U∊›v‚FγÞ•: try it online. \$\endgroup\$ Commented Sep 30, 2021 at 8:19
7
\$\begingroup\$

PHP, 122 124 127 120 115 101 bytes

Follows the "standard" <letter><filler>t structure.
I tried to come up with words that weren't used before by anyone.
If you see a word that you want me to replace, tell me.

foreach(range(A,Z)as$k=>$c)echo"$c is for $c",ceaoaaei0eieeouoaaei0eeaei[$k]?:[I=>ka,U=>ni][$c],"t\n";

The newline is represented as \n but counted as 1 byte.


Output:

A is for Act
B is for Bet
C is for Cat
D is for Dot
E is for Eat
F is for Fat
G is for Get
H is for Hit
I is for Ikat
J is for Jet
K is for Kit
L is for Let
M is for Met
N is for Not
O is for Out
P is for Pot
Q is for Qat
R is for Rat
S is for Set
T is for Tit
U is for Unit
V is for Vet
W is for Wet
X is for Xat
Y is for Yet
Z is for Zit

Weird words:

  • ikat:

    Ikat, or ikkat, is a dyeing technique used to pattern textiles that employs resist dyeing on the yarns prior to dyeing and weaving the fabric.

  • xat:

    A carved pole erected as a memorial to the dead by some Indians of western North America

  • zit:

    a pimple; skin blemish.

  • qat:

    Catha edulis (khat, qat) is a flowering plant native to the Horn of Africa and the Arabian Peninsula.

\$\endgroup\$
15
  • \$\begingroup\$ Clever solution I was going to do something similar, glad to see this! +1 \$\endgroup\$ Commented Feb 8, 2017 at 23:27
  • 1
    \$\begingroup\$ These aren't english words.... \$\endgroup\$ Commented Feb 8, 2017 at 23:28
  • \$\begingroup\$ @ConorO'Brien Are you sure? PHP is all written in English, as far as I know. \$\endgroup\$ Commented Feb 8, 2017 at 23:31
  • 5
    \$\begingroup\$ @IsmaelMiguel things like vprintf and zend_version are most certainly not english words. Very few of these entities are actually words. \$\endgroup\$ Commented Feb 8, 2017 at 23:32
  • 1
    \$\begingroup\$ I wouldn't call zit a weird word, at least, I think everyone should already know what it means. \$\endgroup\$
    – mbomb007
    Commented Feb 10, 2017 at 14:24
6
\$\begingroup\$

Pyke, 55 51 48 bytes

26.f[1R].C".d"R+E)DGjt@.^.Il 6>( F['h .dRdJl5

Try it here!

Link is for 3 length and doesn't qualify as words include conjunctives.

    [1R].C".d"R+E)                            - def function [i):
     1R]                                      -     [1, i]
        .C                                    -    chr(^)
          ".d"R+                              -   ".d"+ ^
                E                             -  eval(^) (dictionary lookup of length 1)
                                              -    gets the `i`th word in the dictionary

26.f[             DGjt@.^.Il 6>(              -  first_26():
    [                                         -     function(i)
                       .^                     -    ^.startswith(v)
                   Gjt@                       -     alphabet[current_iter-1]
                         .Il 6>               -   if ^:
                           l 6>               -    len(function(i)) > 6
                                 F['h .dRdJl5 - for i in ^:
                                  ['h         -     function(i)[0], function(i)
                                      .d      -    "is for" (unprintables 0x02, 0x07, 0x06)
                                        R     -    rotate(^, ^^)
                                         dJ   -   " ".join(^)
                                           l5 -  ^.capitalize()

Outputs:

A is for available
B is for because
C is for community
D is for download
E is for english
F is for features
G is for getting
H is for hardware
I is for increase
J is for jewelry
K is for kitchen
L is for locations
M is for manufacturer
N is for northern
O is for outdoor
P is for protein
Q is for quickly
R is for religion
S is for surgery
T is for thousands
U is for universal
V is for vehicles
W is for weekend
X is for xenical
Y is for youngest
Z is for zoofilia

You can test this outside of Pyke using same algorithm. Requires dictionary.json.

import json, string

with open("dictionary.json") as f_obj:
    words=json.load(f_obj)

rtn=[]
i=0
while len(rtn) != 26:
    cur_word=words[i]
    if cur_word[0]==string.lowercase[len(rtn)]:
        if len(cur_word) > 6:
            rtn.append(cur_word)
    i += 1

for i in rtn:
    print("{} is for {}".format(i[0].upper(), i))
\$\endgroup\$
5
  • \$\begingroup\$ No. Also, I get an error running your code. \$\endgroup\$
    – mbomb007
    Commented Feb 8, 2017 at 19:41
  • \$\begingroup\$ Timeout running code. BAD EVAL Make sure you update your "Try it online" link. \$\endgroup\$
    – mbomb007
    Commented Feb 8, 2017 at 19:45
  • 2
    \$\begingroup\$ Z is for zoofilia I would seriously consider before letting my kids sing this. \$\endgroup\$
    – zeppelin
    Commented Feb 8, 2017 at 20:28
  • \$\begingroup\$ @zeppelin chat.stackexchange.com/transcript/message/35306609#35306609 \$\endgroup\$
    – Blue
    Commented Feb 8, 2017 at 20:32
  • \$\begingroup\$ For anyone doing a double-take like I did: english is not always capitalized. ;) \$\endgroup\$
    – DLosc
    Commented Feb 8, 2017 at 22:58
6
\$\begingroup\$

Japt, 52 50 bytes

Collaborated with @ETHproductions

;B£[R`  f `Od"¥¥º"gY]qXÃx

Contains many unprintables. Test it online!

The word list is:

All Bar Can Dan Ear Fan Gas Has Ill Jar Kit Led Man Nit Oar Pan Qat Rat Sat Tan Udo Vat War Xis Yes Zit

Japt uses the shoco string compression library, which reduces common runs of lowercase letters into by a byte. Here is a full list of all two-letter runs that are condensed into one byte:

an,ar,as,at,be,bl,bo,bu,ca,ce,ch,co,da,de,di,do,ed,en,er,es,ha,he,hi,ho,im,in,is,it,le,li,ll,ly,ma,me,mi,mo,nd,ne,ng,nt,of,on,or,ou,ra,re,ri,ro,se,sh,si,st,te,th,ti,to,ul,ur,us,ut,wa,we,wh,wi

So the idea is to form a word with one of these pairs for each letter of the alphabet.

;B£   [R`  f `    Od"string"gY]qXÃ x
;BmXY{[R" is for "Od"string"gY]qX} x

;                                      // Among other things, set B to "ABC...XYZ".
 B                                     // Split B into chars.
    mXY{                           }   // Map each item X and index Y to the following:
                      "string"gY       //   Take the char at index Y in the compressed str.
                    Od                 //   Decompress.
        [R" is for "            ]      //   Put this in an array with a newline and " is for ".
                                 qX    //   Join on X, giving "\n{X} is for {word}".
                                    x  // Trim. This removes the leading newline.
                                       // Implicit: output result of last expression

One interesting thing to note is that while Japt can implicitly decompress a string wrapped in backticks, that's actually a byte longer here because you'd have to grab two chars in the decompressed string, rather than one.

\$\endgroup\$
6
\$\begingroup\$

Ruby, 93 84 69 63 58 62 bytes

?A.upto(?Z){|l|puts l+" is for #{"AnDoIsUn"[/#{l}./]||l+?a}t"}

Output:

A is for Ant
B is for Bat
C is for Cat
D is for Dot
E is for Eat
F is for Fat
G is for Gat
H is for Hat
I is for Ist
J is for Jat
K is for Kat
L is for Lat
M is for Mat
N is for Nat
O is for Oat
P is for Pat
Q is for Qat
R is for Rat
S is for Sat
T is for Tat
U is for Unt
V is for Vat
W is for Wat
X is for Xat
Y is for Yat
Z is for Zat

All 3-letter words ending with 't', most of them with 'at'.

Using controversial words (iat, dat, amp. ump) - 55 bytes:

?A.upto(?Z){|l|puts l+" is for "+l+("AU"[l]?"mp":"at")}

Still trying to find a pattern, I think it's possible to use just 2 different endings, and simplify everything.

Thanks @Value Ink and @Business cat for helping.

\$\endgroup\$
10
  • 1
    \$\begingroup\$ Qat and Xis (plural of Xi) are words, so you can use them and also reduce your lookup regex to /#{l}../ \$\endgroup\$
    – Value Ink
    Commented Feb 8, 2017 at 18:33
  • \$\begingroup\$ Thanks, I was thinking about something similar but I am away from my PC now, I will definitely check that. \$\endgroup\$
    – G B
    Commented Feb 8, 2017 at 18:50
  • \$\begingroup\$ Actually I was trying to find some 5 letter words for the missing letters: array, essay, inlay... But I am stuck on that. :-( \$\endgroup\$
    – G B
    Commented Feb 8, 2017 at 20:12
  • 1
    \$\begingroup\$ Kat is a valid word, so you can remove the special case for kit. \$\endgroup\$ Commented Feb 9, 2017 at 14:36
  • 1
    \$\begingroup\$ I thought of "dat" and "zat" but they are both the same conjunction (that) and slang, both of which types of words are barred. "amp" and "ump" seem to be abbreviations of "ampere"/"amplify" and "umpire". "IAT" is an acronym, so that's no good either. \$\endgroup\$ Commented Feb 9, 2017 at 15:53
6
\$\begingroup\$

///, 163 bytes

/2/ad//1/ is for /A1Add
B1B2
C1C2
D1D2
E1Eat
F1F2
G1Goo
H1H2
I1Irk
J1Job
K1Kob
L1L2
M1M2
N1Nob
O1Owl
P1P2
Q1Qat
R1R2
S1S2
T1T2
U1Use
V1Vat
W1W2
X1X-ray
Y1Yob
Z1Zoo

Try it online

Yob - n. - A cruel and brutal fellow

Hm, learned something today...

\$\endgroup\$
2
  • 2
    \$\begingroup\$ In the UK a yob is a lout, a thug, or a boor; more uncouth and rowdy than cruel and brutal. \$\endgroup\$ Commented Feb 8, 2017 at 18:55
  • 1
    \$\begingroup\$ In Russian "Yob" is a shortened past form of obscene verb, which, basically, is an equivalent of "f*ck" in English. The more you know... \$\endgroup\$ Commented Feb 9, 2017 at 7:36
5
\$\begingroup\$

05AB1E, 72 68 bytes

Code:

”–³æéÁéî¹àæÑå꧵™Ä‚æ†Í„΢׆™ƒÛÌ´ŸÄ«©‡¯†‚IJ‚Ò„©É€ŠÛì„”#vy¬…ÿ€ˆ€‡ð«ì,

Uses the CP-1252 encoding. Try it online!

Explanation

The following code:

”–³æéÁéî¹àæÑå꧵™Ä‚æ†Í„΢׆™ƒÛÌ´ŸÄ«©‡¯†‚IJ‚Ò„©É€ŠÛì„”#

pushes this array:

['Apple', 'Banana', 'Carol', 'Door', 'Elephant', 'Frog', 'Goat', 'Hat', 'Ice', 'January', 'Key', 'Love', 'Mom', 'Never', 'Open', 'Paste', 'Queen', 'Rice', 'Star', 'Test', 'Underwear', 'Very', 'Water', 'Xanax', 'Yellow', 'Zoloft']

And is processed using the following code:

vy¬…ÿ€ˆ€‡ð«ì,

vy              # For each string in the array
  ¬             # Get the first letter of that string
   …ÿ€ˆ€‡       # Push the string "ÿ is for" where 'ÿ' is the first letter of the string
         ð«     # Append a space character
           ì    # Prepend this string to the current string from the array
            ,   # Print with a newline
\$\endgroup\$
7
  • \$\begingroup\$ Can you explain why that pushes that array? \$\endgroup\$ Commented Feb 8, 2017 at 17:13
  • \$\begingroup\$ I think 05AB1E has some built in words that can be represented by 2 bytes in a string. \$\endgroup\$
    – 12Me21
    Commented Feb 8, 2017 at 18:16
  • \$\begingroup\$ @12Me21 that's cool! ”–³”=Apple and int(–³,214)=23891 but I still don't see the correlation here. \$\endgroup\$ Commented Feb 8, 2017 at 18:35
  • \$\begingroup\$ I believe this is the list: github.com/Adriandmen/05AB1E/blob/master/dictionary.py \$\endgroup\$
    – 12Me21
    Commented Feb 8, 2017 at 18:37
  • 2
    \$\begingroup\$ @carusocomputing Here is a more detailed description of how the compression and decompression works. \$\endgroup\$
    – Adnan
    Commented Feb 8, 2017 at 18:38
4
\$\begingroup\$

Clojure, 159 232 bytes

Well, now it's certainly non-competing solution as it would be far easier to hardcode the words used. Putting it out there just for the sake of having correct answer (and not using others' list of words).

(mapv #(println(str(char %)" is for"(first(re-seq(re-pattern(str" "(char(+ % 32))"+\\w{3,} "))
    (reduce(fn[a b](str a(with-out-str(load-string(str "(doc "b")")))))" xyst "(map str(keys(ns-publics 'clojure.core))))))))(range 65 91))

Basically still gets all the functions defined in clojure.core namespace, but after that evaluates doc <function name> and puts it into string. After that concatenates it into one huge string (with the word xyst) and finds appropriate words from there. Should be run in Clojure REPL.

Output:

A is for arbitrary
B is for being
C is for changes
D is for determined
E is for exception
F is for failed
G is for given
H is for held
I is for items
J is for java
K is for keys
L is for lazy
M is for must
N is for notified
O is for option
P is for performed
Q is for queued
R is for returns
S is for state
T is for true
U is for uses
V is for validator
W is for were
X is for xyst
Y is for yields
Z is for zero

Old solution:

(mapv #(println(str(char %)" is for "(some(fn[a](and(=(.charAt a 0)(char(+ % 32)))a))(conj(map str(keys(ns-publics 'clojure.core)))"orb""yes"))))(range 65 91))
\$\endgroup\$
3
  • \$\begingroup\$ or, not orb, for 1 byte. \$\endgroup\$
    – wizzwizz4
    Commented Feb 8, 2017 at 20:58
  • 1
    \$\begingroup\$ The minimum length is 3 letters \$\endgroup\$
    – 12Me21
    Commented Feb 8, 2017 at 22:12
  • \$\begingroup\$ @mbomb007 updated. \$\endgroup\$
    – cliffroot
    Commented Feb 9, 2017 at 11:20
4
\$\begingroup\$

JavaScript (ES6), 82 bytes

_=>btoa`pb
è¡Záî"Âh*"è1£b:ãÚA¤hJ$âRu^YåÚaæb`.replace(/(.)./g,`$1 is for $&t
`)

An anonymous function returning a string. Contains unprintables; here's a version that doesn't:

_=>btoa`\x02pb
\x80è\x11¡Z\x18áî"Âh*"è1£b:ãÚA¤hJ$âRu^YåÚaæb`.replace(/(.)./g,`$1 is for $&t
`)

This uses @JonathanAllen's technique, using only three-letter words that end in t. The string decompresses to AnBiCoDoEaFaGOHuIsJoKiLoMaNiOuPaQaRoSiTiUnVeWeXaYeZi.

I tried chaining two-letter pairs like so:

Ace
 Bee
  Cee
   Dew
    Ewe
     ...

I've now made it all the way to X but got stuck on Y; as far as I can tell, the only attainable three-letter X word is Xis, and there's no three-letter word starting with Ys.

For the record, the full string was ceeeweeereueaebiueeiziais...

\$\endgroup\$
5
  • \$\begingroup\$ According to Wiktionary, you could use uzi and tiz... \$\endgroup\$
    – DLosc
    Commented Feb 8, 2017 at 23:06
  • \$\begingroup\$ @DLosc Great idea. Then you'd have to do sei, ski, or sri, which leaves you with ree, roe, rue, rye, which leaves you with... the only three letter q-words I can find are qat, qis, and qua. Is there a Wiktionary page with more three-letter words? \$\endgroup\$ Commented Feb 8, 2017 at 23:46
  • \$\begingroup\$ There's a category for three-letter words, but it isn't a complete list. For instance, it doesn't contain que (which I only know about because another answer here used it). (Not sure there's a p-word that ends with u, though.) \$\endgroup\$
    – DLosc
    Commented Feb 9, 2017 at 7:50
  • \$\begingroup\$ @DLosc I was already using piu, so that's not a problem at all :P Thanks! \$\endgroup\$ Commented Feb 9, 2017 at 18:06
  • \$\begingroup\$ Hm. piu seems pretty borderline--wiktionary doesn't have it as English, and dictionary.com has it as più (dunno how we're considering accents for this challenge). But yeah, ys_ would be a problem. \$\endgroup\$
    – DLosc
    Commented Feb 9, 2017 at 20:59
3
\$\begingroup\$

SOGL 0.8.1, 60 32 bytes

χ3½⌠↓-ζ⁄∞Nη6′⁵‘Z{t",t5~r‘ooKo to

Explanation:

χ3½⌠↓-ζ⁄∞Nη6′⁵‘                   push "niooaaoasoioaiaaaoiineeaei"
               Z{                 for each letter of the uppercase alphabet
                 t                output the letter in a newline (and disable implicit output)
                  ",t5~r‘o        append " is for "
                          o       append the letter
                           Ko     append the 1st letter of the 1st string (the 2nd letters) and remove it
                              to  append "t"

This is pretty much Jonathan Allan's answer, but ported to this language.

Old version: (SOGL 0.8.2)

Z"sηΒ…@Ν┘$JP6*š∙╬F▓÷Σ⁷4⌠    ⁹{Tīο⁾α⅝½Χ<▼½Ξμ‚‘θ’»∫wGKO",t5~r‘P≥o

                                                              
Z                                                             push the uppercase alphabet
 "sηΒ…@Ν┘$JP6*š∙╬F▓÷Σ⁷4⌠    ⁹{Tīο⁾α⅝½Χ<▼½Ξμ‚‘                  push the 27 words separated by spaces using the languages english compression (BCD...XYZA)
                                          θ                   split on spaces
                                           ’»∫                repeat 27 times (push 0-based pointer)
                                              w               get the 1-indexed item of the array (so 0 = last, 1 = first, 2 = 2nd,...)
                                               G              put the 1st thing on stack ontop (the alphabet)
                                                K             get the 1st letter and remove it
                                                 O            output it
                                                  ",t5~r‘     push compressed " is for "
                                                         P    append that (and disable last auto-output)
                                                          ≥   put the 1st thing on the stack below everything
                                                           o  append the last thing (the word from the word list)

output:

A is for against
B is for being
C is for could
D is for down
E is for even
F is for first
G is for good
H is for had
I is for into
J is for just
K is for know
L is for little
M is for much
N is for nothing
O is for other
P is for project
Q is for quite
R is for right
S is for said
T is for their
U is for under
V is for very
W is for with
X is for xavier
Y is for you
Z is for zoo

This is not the shortest this language can do, but should be the best with the words hard coded.

\$\endgroup\$
3
\$\begingroup\$

Mathematica, 97 bytes

a@c_:={ToUpperCase@c," is for ",Select[WordList[],#~StringTake~1==c&][[3]],"
"};a/@Alphabet[]<>""

Looks in Mathematica's WordList for the third word beginning with each letter; this avoids one-letter words and interjections. Has a trailng newline.

A is for aardvark
B is for babble
C is for cabala
D is for dabbled
E is for eagerly
F is for fable
G is for gabble
H is for haberdashery
I is for iambus
J is for jabberer
K is for kaleidoscope
L is for label
M is for mac
N is for nacelle
O is for oak
P is for pabulum
Q is for quackery
R is for rabbinate
S is for sable
T is for tabbouleh
U is for udder
V is for vacant
W is for wad
X is for xenophobic
Y is for yachting
Z is for zapper
\$\endgroup\$
1
  • \$\begingroup\$ eep, totally forgot, thanks \$\endgroup\$ Commented Feb 8, 2017 at 20:29
3
\$\begingroup\$

Groovy, 76 73 bytes

(edited from 76 to 73 bytes, thank you cat)

Inspired by the ruby solution:

('A'..'Z').any{i->println"$i is for ${'AntIvyUse'.find(/$i../)?:i+'at'}"}

we use any instead of each as it is shorter and all the println statements return false. For the special cases in the string, we use String.find which in groovy returns the match or null. On null we use the elvis operator ?: to return a word ending in at instead.

Prints out:

A is for Ant
B is for Bat
C is for Cat
D is for Dat
E is for Eat
F is for Fat
G is for Gat
H is for Hat
I is for Ivy
J is for Jat
K is for Kat
L is for Lat
M is for Mat
N is for Nat
O is for Oat
P is for Pat
Q is for Qat
R is for Rat
S is for Sat
T is for Tat
U is for Use
V is for Vat
W is for Wat
X is for Xat
Y is for Yat
Z is for Zat

Groovy, recursion, 74 bytes

{i->println"$i is for ${'AntIvyUse'.find(/$i../)?:i+'at'}";call(++i)}('A')

prints out the text from the first answer and then throws a PatternFormatException. We call the closure recursively starting with 'A' and incrementing ++char until the character after Z throws the error.

Groovy, by cheating, 77 bytes

With the risk of being lynched:

print 'http://codegolf.stackexchange.com/q/109502'.toURL().text[21796..22189]

i.e. read the data in this page and print out the definition of a valid answer at the beginning. In my defense...it does print out the requested answer...now nobody edit the page...

Groovy, using 'times', 81 bytes

Building on the python answer with the three letter word pattern:

26.times{i,c=i+65->printf"%c is for %c${'niooaauusoioaiuaaoiineeaei'[i]}t\n",c,c}

prints:

A is for Ant
B is for Bit
C is for Cot
D is for Dot
E is for Eat
F is for Fat
G is for Gut
H is for Hut
I is for Ist
J is for Jot
K is for Kit
L is for Lot
M is for Mat
N is for Nit
O is for Out
P is for Pat
Q is for Qat
R is for Rot
S is for Sit
T is for Tit
U is for Unt
V is for Vet
W is for Wet
X is for Xat
Y is for Yet
Z is for Zit

Groovy, by recursing on main(...), 83 bytes

Assuming we count newlines as one character.

i=args?args[0]:'A'
println"$i is for ${'AntIvyUse'.find(/$i../)?:i+'at'}"
main(++i)

prints out the text from the first answer and then throws a PatternSyntaxException.

Groovy, using eachWithIndex, 88 bytes

'niooaauusoioaiuaaoiineeaei'.eachWithIndex{c,i->char x=i+65;println "$x is for $x${c}t"}

Groovy, using transpose, 102 bytes

['A'..'Z','niooaauusoioaiuaaoiineeaei'as List].transpose().each{println it[0]+" is for ${it.join()}t"}
\$\endgroup\$
2
  • \$\begingroup\$ Kat is a valid word, so you can remove the special case for kit. \$\endgroup\$ Commented Feb 9, 2017 at 14:34
  • \$\begingroup\$ edited, thank you. Saved me 3 bytes : ) \$\endgroup\$ Commented Feb 9, 2017 at 14:38
2
\$\begingroup\$

05AB1E, 77 bytes

•‹T1qA‹rËöf#ùqÈ$>M©ÈñM£r°§°Ü]€¡3¸/©#bÍ'ò7DÉø½D—¹û©˜Òו36B3ôvy™¬"ÿ is for ÿ"}»

Try it online!

Uses the following string compressed:

ASSBINCATDOTEATFATGOTHATILLJOTKITLOTMETNOTOATPATQUEROTSETTITUSEVATWETXISYIPZAP

Converted to Base-214:

‹T1qA‹rËöf#ùqÈ$>M©ÈñM£r°§°Ü]€¡3¸/©#bÍ'ò7DÉø½D—¹û©˜Ò×

Used a list of 3-letter scrabble words: http://wordfinder.yourdictionary.com/letter-words/3

Output is as follows:

A is for Ass
B is for Bin
C is for Cat
D is for Dot
E is for Eat
F is for Fat
G is for Got
H is for Hat
I is for Ill
J is for Jot
K is for Kit
L is for Lot
M is for Met
N is for Not
O is for Oat
P is for Pat
Q is for Que
R is for Rot
S is for Set
T is for Tit
U is for Use
V is for Vat
W is for Wet
X is for Xis
Y is for Yip
Z is for Zap

Had a 70 byte version, but 2-letter words aren't allowed.


Explained:

•‹T1qA‹rËöf#ùqÈ$>M©ÈñM£r°§°Ü]€¡3¸/©#bÍ'ò7DÉø½D—¹û©˜Òו # Compressed String

36B3ô                   # Decompress, split into 3s.
     v               }  # For each word...
      y™¬"ÿ is for ÿ"   # Take first letter of word, interpolate.
                      » # Print with newlines.
\$\endgroup\$
3
  • \$\begingroup\$ qui is not an English word. Looking this up reveals only a Latin word. \$\endgroup\$
    – mbomb007
    Commented Feb 8, 2017 at 19:49
  • \$\begingroup\$ @mbomb007 was supposed to be Que I knew there was a 3 letter legal scrabble word, misspelled it. \$\endgroup\$ Commented Feb 8, 2017 at 19:59
  • \$\begingroup\$ Nice words :) could be replaced with ,. \$\endgroup\$
    – Emigna
    Commented Feb 9, 2017 at 7:35
2
\$\begingroup\$

SmileBASIC, 131 113 82 81 bytes

FOR I=1TO 26L$=CHR$(I+64)?L$;" is for ";L$;@niooaauusoioaiuaaoiineeaei[I];"t
NEXT

Now using words that in t

\$\endgroup\$
2
2
\$\begingroup\$

Lithp, 136 125 117 bytes

((import lists)(each(split "niooaauusoioaiuaaoiineeaei" "")
#X,C::((print(chr(+ 65 C))"is for"(+(chr(+ 65 C))X "t"))))

(Split for readability)

Try it online!

This is pretty much a port of the Python answer

  • Saved 11 bytes by using each's index
  • Saved 8 bytes by removing useless call to (scope #)

Output:

A is for Ant
B is for Bit
C is for Cot
D is for Dot
E is for Eat
F is for Fat
G is for Gut
H is for Hut
I is for Ist
J is for Jot
K is for Kit
L is for Lot
M is for Mat
N is for Nit
O is for Out
P is for Pat
Q is for Qat
R is for Rot
S is for Sit
T is for Tit
U is for Unt
V is for Vet
W is for Wet
X is for Xat
Y is for Yet
Z is for Zit
\$\endgroup\$
2
  • 2
    \$\begingroup\$ Great name! (I don't, thuffer from a lithp, doethe the language have thuch a thpeech ithue though?) \$\endgroup\$ Commented Feb 9, 2017 at 14:14
  • 1
    \$\begingroup\$ Thank you! Nope, the language is fine with pronunciation. It's more that it's a bastardized version of Lisp. I just found Lisp far too difficult to wrap my head around, Lithp is my take on it in a way that makes sense to me. It should be much more readable than most Lisp code. \$\endgroup\$
    – Andrakis
    Commented Feb 9, 2017 at 14:16
2
\$\begingroup\$

Perl 5, 72 bytes

say"$_ is for $_",(niooaaoasoioaiaaaoiineeaei=~/./g)[-65+ord],t for A..Z

Try it online!

\$\endgroup\$
1
  • \$\begingroup\$ Nice can't think of an alternative approach. You can save a few bytes using $-++ instead of the trick with ord though: Try it online! \$\endgroup\$ Commented May 10, 2022 at 18:35
1
\$\begingroup\$

Batch, 250 bytes

@set s=ABCDEFGHIJKLMNOPQRSTUVWXYZ
@for %%w in (eon dellium zar jinn lbow hon nat our rk unta not lama nemonic domo uija sycho uay ye ee sunami rn ex rap enophobe ou ugzwang)do @call:c %%w
@exit/b
:c
@echo %s:~0,1% is for %s:~0,1%%1
@set s=%s:~1%

Since I was never going to get a decent score, I went for the shortest humorous words that I could find:

A is for Aeon
B is for Bdellium
C is for Czar
D is for Djinn
E is for Elbow
F is for Fhon
G is for Gnat
H is for Hour
I is for Irk
J is for Junta
K is for Knot
L is for Llama
M is for Mnemonic
N is for Ndomo
O is for Ouija
P is for Psycho
Q is for Quay
R is for Rye
S is for See
T is for Tsunami
U is for Urn
V is for Vex
W is for Wrap
X is for Xenophobe
Y is for You
Z is for Zugzwang
\$\endgroup\$
1
\$\begingroup\$

stacked, 72 bytes

There are two for 72 bytes!

65@i$'niooaauusoioaiuaaoiineeaei'{!i#::' is for '+\n+'t'+ +out i 1+@i}"!
{!n#::' is for '+\'niooaauusoioaiuaaoiineeaei'n 65-#+'t'+ +out}65 90 for

Try it online! Using that awesome pattern. (Before you ask, ++ would be a single token, so + + is used instead.)

Both work by iterating from 65 to 90 and getting the correct character sequence. Notes:

  • #: is an alias for chr
  • # is an alias for get
  • {!...} is the same as { n : ... } (lambda with n as an parameter)

For 73 bytes:

'niooaauusoioaiuaaoiineeaei'toarr{e i:65 i+#::' is for '+\e+'t'+ +out}map
\$\endgroup\$
1
\$\begingroup\$

Mathematica 93 Bytes

ToUpperCase@#<>" is for "<>Cases[WordList[],s_/; s~StringPart~1==#][[9]]&/@Alphabet[]//Column

yields

A is for abandoned
B is for babushka
C is for cabin
D is for dactylic
E is for eardrum
F is for fabricator
G is for gadabout
H is for habitation
I is for ice
J is for jackal
K is for kappa
L is for laboratory
M is for macaroni
N is for nagger
O is for oarsman
P is for pachysandra
Q is for quadratic
R is for rabidness
S is for saccharin
T is for tableland
U is for ulcer
V is for vacationist
W is for wadi
X is for xylene
Y is for yammer
Z is for zebra
\$\endgroup\$
1
\$\begingroup\$

Groovy, 72 bytes

c=65;"niooaauusoioaiuaaoiineeaei".any{printf"%c is for %<c%st\n",c++,it}

Output

A is for Ant
B is for Bit
C is for Cot
D is for Dot
E is for Eat
F is for Fat
G is for Gut
H is for Hut
I is for Ist
J is for Jot
K is for Kit
L is for Lot
M is for Mat
N is for Nit
O is for Out
P is for Pat
Q is for Qat
R is for Rot
S is for Sit
T is for Tit
U is for Unt
V is for Vet
W is for Wet
X is for Xat
Y is for Yet
Z is for Zit
\$\endgroup\$
1
\$\begingroup\$

Python 3, 145 137 135 bytes

I sacrificed some bytes to pseudo-randomise the output with each run. The idea is to look for lowercase words of at least 3 characters in /usr/share/dict/words and then pick one from that list using id([x])%99.

import re
for x in range(65,91):print("%c is for "%x+re.findall("\n(%c.{3,})"%(x+32),open('/usr/share/dict/words').read())[id([x])%99])

Edits

  • Removed title() as words don't have to be capitalised.
  • Changed the regex to "\n(%c.{3,})" (+ 3 bytes) to allow removal of ,re.M (- 5 bytes).

Example output:

A is for abacinate
B is for bacchantic
C is for caback
D is for dactylosternal
E is for eagless
F is for factful
G is for gabbroic
H is for hackneyed
I is for iambize
J is for jacutinga
K is for kadaya
L is for labra
M is for macaco
N is for nailwort
O is for oakenshaw
P is for pachysomia
Q is for quachil
R is for racer
S is for sabbath
T is for tabulable
U is for ubication
V is for vagabondism
W is for wabe
X is for xenobiosis
Y is for yacca
Z is for zeed
\$\endgroup\$
3
  • \$\begingroup\$ Not sure they're all valid. For instance, I can't find a definition for Qohele, though a search reveals that it is a book or volume of sacred text. \$\endgroup\$
    – Andrakis
    Commented Feb 9, 2017 at 14:29
  • 1
    \$\begingroup\$ Just noticed that my regex doesn't match until the end of each word -- will fix. \$\endgroup\$ Commented Feb 9, 2017 at 14:37
  • \$\begingroup\$ Fixed it. Now only looking for lowercase, complete words to not have names in there. \$\endgroup\$ Commented Feb 9, 2017 at 15:25
1
\$\begingroup\$

GNU sed, 81 + 1(r flag) = 82 bytes

This is a sed implementation of the word list from Jonathan Allan's answer.

s:$:AnBiCoDoEaFaGuHuIsJoKiLoMaNiOuPaQaRoSiTiUnVeWeXaYeZi:
s:(.).:\1 is for &t\n:g

The words, except the shared ending letter t, are given in concatenated form on line 1, and then printed in the requested format by line 2. A trailing newline is present.

Run:

sed -rf alphabet_song.sed <<< ""
\$\endgroup\$
1
\$\begingroup\$

Java 7, 124 121 bytes

String c(){String r="";for(char c=65;c<91;r+=c+" is for "+c+"baaonaiineioaeaoaaeileeaoi".charAt(c++-65)+"t\n");return r;}

Based on @JonathanAllen's answer, since Java has no fancy built-in dictionary. ;) I tried to find another ending letter for the entire alphabet (like s or n or y), or a middle letter (like a or e), but most were missing just one or two words, so I ended up using t as well. Words are manually chosen from wordhippo.com.

Ungolfed:

Try it here.

class M{
  static String c(){String r="";for(char c=65;c<91;r+=c+" is for "+c+"baaonaiineioaeaoaaeileeaoi".charAt(c++-65)+"t\n");return r;}

  public static void main(String[] a){
    System.out.println(c());
  }
}

Output:

A is for Abt
B is for Bat
C is for Cat
D is for Dot
E is for Ent
F is for Fat
G is for Git
H is for Hit
I is for Int
J is for Jet
K is for Kit
L is for Lot
M is for Mat
N is for Net
O is for Oat
P is for Pot
Q is for Qat
R is for Rat
S is for Set
T is for Tit
U is for Ult
V is for Vet
W is for Wet
X is for Xat
Y is for Yot
Z is for Zit
\$\endgroup\$
1
  • 1
    \$\begingroup\$ +1 for +a+++. I like writing those :P \$\endgroup\$
    – Poke
    Commented Feb 10, 2017 at 16:09

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