46
3
Since 2009, Android's version code names have been confectionery-themed. Android 1.5 is Cupcake, Android 1.6 is Donut, Android 2.0 is Eclair, etc.. In fact, the version names are alphabetical!
C -> Cupcake
D -> Donut
E -> Eclair
F -> Froyo
G -> Gingerbread
H -> Honeycomb
I -> Ice Cream Sandwich
J -> Jellybean
K -> Kitkat
L -> Lollipop
M -> Marshmallow
N -> Nougat
O -> Oreo
In order:
Cupcake, Donut, Eclair, Froyo, Gingerbread, Honeycomb, Ice Cream Sandwich, Jellybean, Kitkat, Lollipop, Marshmallow, Nougat, Oreo
Challenge
Write a program/function that takes a letter from C
to O
and outputs its respective Android version code name.
Specifications
- Standard I/O rules apply.
- Standard loopholes are forbidden.
- You can choose to either support lowercase input or uppercase input or even both.
- The output may be in title case (
Cupcake
) or completely lower case (eclair
).Ice cream sandwich
may be capitalized however you like. (I didn't expect it to cause so much confusion...) - This challenge is not about finding the shortest approach in all languages, rather, it is about finding the shortest approach in each language.
- Your code will be scored in bytes, usually in the encoding UTF-8, unless specified otherwise.
- Built-in functions (Mathematica might have one :P) that compute this sequence are allowed but including a solution that doesn't rely on a built-in is encouraged.
- Explanations, even for "practical" languages, are encouraged.
Test cases
These are uppercase and title case.
Input Output
F Froyo
I Ice Cream Sandwich
J Jellybean
N Nougat
G Gingerbread
L Lollipop
In a few better formats:
F, I, J, N, G, L
f, i, j, n, g, l
F I J N G L
f i j n g l
@WheatWizard That's much harder though – Mr. Xcoder – 2017-08-22T17:23:53.023
8@Mr.Xcoder Are you saying its not a dupe because its easier? This is a dupe precisely because it is an easier version of an existing question. We've already done this type of question to death and this one provides absolutely nothing new or interesting to the genre. – Post Rock Garf Hunter – 2017-08-22T17:30:53.593
2@WheatWizard I think the former is a better dupe, since the latter is restricted source. – Mr. Xcoder – 2017-08-22T17:57:09.290
9It might be a dupe of some other challenge. But Help me recognize my monster is asking for string to symbol conversion (which leads to hash-based solutions). This one is asking for symbol to string. – Arnauld – 2017-08-22T18:02:09.667
2
FYI, It should be
– mbomb007 – 2017-08-22T19:04:41.307Jelly Bean
, with a space. https://en.wikipedia.org/wiki/Android_Jelly_Bean1Darn, I lost the chance of incrementing everybody's byte count by 1. – totallyhuman – 2017-08-22T19:08:12.363
1If you want to be correct on the versions, you should probably just update it and tell people to change their answers. – mbomb007 – 2017-08-22T19:08:53.910
No, that's a little too annoying, don't you think? – totallyhuman – 2017-08-22T19:09:33.880
@totallyhuman you can do what I did on the nun challenge and update each one individually :P – MD XF – 2017-08-22T19:36:21.160
Should it be
Ice Cream Sandwich
orIce cream sandwich
? The initial code block suggests the former but the test cases suggest the latter. The current winning answer requiresIce cream sandwich
, butThe output may be in title case (Cupcake) or completely lower case (eclair).
....Ice cream sandwich
is not in title case. – MD XF – 2017-08-22T19:38:01.037Ice Cream Sandwich
is title case. And, again, all of those are fine. – totallyhuman – 2017-08-22T19:40:07.470In
Ice cream sandwich
thec
ands
are not capitalized. – MD XF – 2017-08-22T19:40:30.197Ah, I see my mistake. Updated. :) – totallyhuman – 2017-08-22T19:42:49.963
6*coughs* – Magic Octopus Urn – 2017-08-22T20:15:33.960
5@MagicOctopusUrn Yeah, I saw that, too. Unfortunately, it doesn't include
MARSHMALLOW
and later. – mbomb007 – 2017-08-22T20:49:50.2932Closely related – AdmBorkBork – 2017-08-23T19:24:49.080
Note: Cupcake wasn't the first confectionary themed codename: Android 1.1 had the internal codename "Petit four" which is a small bite-sized confectionery, pastry or biscuit. – thomasrutter – 2017-08-25T00:13:21.737