55
\$\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.

| improve this question | | | | |
\$\endgroup\$
  • \$\begingroup\$ I am guessing slang is not allowed, even if listed in proper dictionaries? (e.g. "When she realised she was headed towards the outback again she just pulled a uey!") \$\endgroup\$ – Jonathan Allan Feb 8 '17 at 19:06
  • 1
    \$\begingroup\$ Given some of the answers, this song by Barenaked Ladies seems relevant. \$\endgroup\$ – AdmBorkBork Feb 8 '17 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 Feb 8 '17 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 Feb 9 '17 at 0:33
  • 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 Feb 9 '17 at 15:30

35 Answers 35

1
2
0
\$\begingroup\$

Python 2.X, 147 bytes

Yet another try in python using nltk -

from nltk.corpus import*;k=lambda y:filter(lambda x:y in x[0],words.words());print'\n'.join([chr(i)+' is for '+k(chr(i))[64]for i in range(65,91)])

Output -

A is for Abranchiata
B is for Baconic
C is for Cahokia
D is for Damara
E is for Echium
F is for Fascista
G is for Galenic
H is for Halawi
I is for Ichthyornithidae
J is for Jamaica
K is for Kanauji
L is for Lahontan
M is for Macropodinae
N is for Nankingese
O is for Odelsthing
P is for Palaeeudyptes
Q is for Quintius
R is for Rambo
S is for Sac
T is for Tagula
U is for Ulyssean
V is for Vanguardist
W is for Wallon
X is for Xiphodontidae
Y is for Yazoo
Z is for Zea

Ungolfed

from nltk.corpus import*
k=lambda y:filter(lambda x:y in x[0],words.words())
print'\n'.join([chr(i)+' is for '+k(chr(i))[27]for i in range(65,91)])
| improve this answer | | | | |
\$\endgroup\$
0
\$\begingroup\$

Python 2, 112 bytes

for x in range(26):y=chr(x+65);print y+' is for '+y+'naaoaaeaneieaiaaaaairaeeei'[x:x+1]+('t','n')[x in(8,20,23)]

Try it online!

All of the words end with 't' except for 3 which end with 'n' so we just store the middle letters of the three letter words and indexes of the 3 'n' words and sort out the 'misfits' at the end.

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

Befunge-93, 73 bytes

This just uses three-letter words, where the last letter is always t.

naaoaauanoioaefeauoosaeaei:0\55+\"t"\:0g\"A"+:," rof si ">:#,_$1+:55*`#@_

Try it online!

But with an additional two bytes, we can vary the last letter between t and e and get a more interesting selection.

teuowaeocoaooudouaeosaoaei:"A"+:,0" rof si ">:#,_$,:0g,1+:2%0g,55+,:55*`#@_

Try it online!

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

Perl 5, 72 bytes

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

Try it online!

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

Jelly, 153 bytes (hardcoded words)

“¢r£ẒẸv⁽Ẋ⁷ƥḷṢ⁴kṣe]Ȧ½ṇZṅẸȥɓ!ṗẒ/¿`-¤ḅṘẠṗıBṖ²}çSṘ¦qḤAi\Ḃɲ=T¿?İ®ʋÇIZ(ṅ/ß+oŻ#⁽ƙ©Ḷ!&ẋṡU7FocĊ¶€¢¦ḥLØṀ¿;ȥż!Ọerṫ÷1Ẹjẏ8Ƙ&£ṃṾḊ¿Ṅ⁾ị°ÑBḅQ²€œðḤDẊj£ṅĠsṿBsƤȤ»ṣ”%j“ẉbẊWS»

Try it online!

A is for Apple
B is for Bald
C is for Cabin
D is for Dairy
E is for Eagle
F is for Fact
G is for Gauge
H is for Humid
I is for Iamb
J is for Jar
K is for Keg
L is for Lad
M is for Music
N is for Nose
O is for Oak
P is for Page
Q is for Quart
R is for Rag
S is for Sock
T is for Taco
U is for Udon
V is for Vault
W is for Week
X is for Xylophone
Y is for Yard
Z is for Zoo
| improve this answer | | | | |
\$\endgroup\$
1
2

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.