37
\$\begingroup\$

Write a program or function that prints or returns a string of the alphanumeric characters plus underscore, in any order. To be precise, the following characters need to be output, and no more:

abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_

When printing to stdout, an optional trailing newline after your output is permitted.

Built-in constants that contain 9 or more of the above characters are disallowed.


Shortest code in bytes wins.

This is a very simple challenge, which I believe will generate some interesting answers nevertheless.


Leaderboards

Here is a Stack Snippet to generate both a regular leaderboard and an overview of winners by language.

To make sure that your answer shows up, please start your answer with a headline, using the following Markdown template:

# Language Name, N bytes

where N is the size of your submission. If you improve your score, you can keep old scores in the headline, by striking them through. For instance:

# Ruby, <s>104</s> <s>101</s> 96 bytes

If there you want to include multiple numbers in your header (e.g. because your score is the sum of two files or you want to list interpreter flag penalties separately), make sure that the actual score is the last number in the header:

# Perl, 43 + 2 (-p flag) = 45 bytes

You can also make the language name a link which will then show up in the leaderboard snippet:

# [><>](http://esolangs.org/wiki/Fish), 121 bytes

var QUESTION_ID=85666,OVERRIDE_USER=4162;function answersUrl(e){return"https://api.stackexchange.com/2.2/questions/"+QUESTION_ID+"/answers?page="+e+"&pagesize=100&order=desc&sort=creation&site=codegolf&filter="+ANSWER_FILTER}function commentUrl(e,s){return"https://api.stackexchange.com/2.2/answers/"+s.join(";")+"/comments?page="+e+"&pagesize=100&order=desc&sort=creation&site=codegolf&filter="+COMMENT_FILTER}function getAnswers(){jQuery.ajax({url:answersUrl(answer_page++),method:"get",dataType:"jsonp",crossDomain:!0,success:function(e){answers.push.apply(answers,e.items),answers_hash=[],answer_ids=[],e.items.forEach(function(e){e.comments=[];var s=+e.share_link.match(/\d+/);answer_ids.push(s),answers_hash[s]=e}),e.has_more||(more_answers=!1),comment_page=1,getComments()}})}function getComments(){jQuery.ajax({url:commentUrl(comment_page++,answer_ids),method:"get",dataType:"jsonp",crossDomain:!0,success:function(e){e.items.forEach(function(e){e.owner.user_id===OVERRIDE_USER&&answers_hash[e.post_id].comments.push(e)}),e.has_more?getComments():more_answers?getAnswers():process()}})}function getAuthorName(e){return e.owner.display_name}function process(){var e=[];answers.forEach(function(s){var r=s.body;s.comments.forEach(function(e){OVERRIDE_REG.test(e.body)&&(r="<h1>"+e.body.replace(OVERRIDE_REG,"")+"</h1>")});var a=r.match(SCORE_REG);a&&e.push({user:getAuthorName(s),size:+a[2],language:a[1],link:s.share_link})}),e.sort(function(e,s){var r=e.size,a=s.size;return r-a});var s={},r=1,a=null,n=1;e.forEach(function(e){e.size!=a&&(n=r),a=e.size,++r;var t=jQuery("#answer-template").html();t=t.replace("{{PLACE}}",n+".").replace("{{NAME}}",e.user).replace("{{LANGUAGE}}",e.language).replace("{{SIZE}}",e.size).replace("{{LINK}}",e.link),t=jQuery(t),jQuery("#answers").append(t);var o=e.language;/<a/.test(o)&&(o=jQuery(o).text()),s[o]=s[o]||{lang:e.language,user:e.user,size:e.size,link:e.link}});var t=[];for(var o in s)s.hasOwnProperty(o)&&t.push(s[o]);t.sort(function(e,s){return e.lang>s.lang?1:e.lang<s.lang?-1:0});for(var c=0;c<t.length;++c){var i=jQuery("#language-template").html(),o=t[c];i=i.replace("{{LANGUAGE}}",o.lang).replace("{{NAME}}",o.user).replace("{{SIZE}}",o.size).replace("{{LINK}}",o.link),i=jQuery(i),jQuery("#languages").append(i)}}var ANSWER_FILTER="!t)IWYnsLAZle2tQ3KqrVveCRJfxcRLe",COMMENT_FILTER="!)Q2B_A2kjfAiU78X(md6BoYk",answers=[],answers_hash,answer_ids,answer_page=1,more_answers=!0,comment_page;getAnswers();var SCORE_REG=/<h\d>\s*([^\n,]*[^\s,]),.*?(\d+)(?=[^\n\d<>]*(?:<(?:s>[^\n<>]*<\/s>|[^\n<>]+>)[^\n\d<>]*)*<\/h\d>)/,OVERRIDE_REG=/^Override\s*header:\s*/i;
body{text-align:left!important}#answer-list,#language-list{padding:10px;float:left}table thead{font-weight:700}table td{padding:5px}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <link rel="stylesheet" type="text/css" href="//cdn.sstatic.net/codegolf/all.css?v=83c949450c8b"> <div id="answer-list"> <h2>Leaderboard</h2> <table class="answer-list"> <thead> <tr><td></td><td>Author</td><td>Language</td><td>Size</td></tr></thead> <tbody id="answers"> </tbody> </table> </div><div id="language-list"> <h2>Winners by Language</h2> <table class="language-list"> <thead> <tr><td>Language</td><td>User</td><td>Score</td></tr></thead> <tbody id="languages"> </tbody> </table> </div><table style="display: none"> <tbody id="answer-template"> <tr><td>{{PLACE}}</td><td>{{NAME}}</td><td>{{LANGUAGE}}</td><td>{{SIZE}}</td><td><a href="{{LINK}}">Link</a></td></tr></tbody> </table> <table style="display: none"> <tbody id="language-template"> <tr><td>{{LANGUAGE}}</td><td>{{NAME}}</td><td>{{SIZE}}</td><td><a href="{{LINK}}">Link</a></td></tr></tbody> </table>

\$\endgroup\$
2
  • 2
    \$\begingroup\$ Comments are not for extended discussion; this conversation has been moved to chat. \$\endgroup\$
    – Dennis
    Jul 19 '16 at 0:45
  • \$\begingroup\$ "Built-in constants that contain 9 or more of the above characters are disallowed" sighs in 05AB1E... \$\endgroup\$
    – Makonede
    Feb 24 at 3:43

94 Answers 94

2
\$\begingroup\$

Pyke, 13 bytes

150m.C#P)\_+s

Try it here!

Generates ascii 0-150 and filters by alphanumericness and adds _ to the end

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

05AB1E, 18 16 12 bytes

žyLçá9Ý'_)˜J

Explanation

žyL               # push [1..128]
   ç              # convert to char
    á             # keep only members of the alphabet
     9Ý           # push [0..9]
       '_         # push underscore
         )˜J      # add to lists of lists, flatten and join
                  # implicit output

Try it online

Edit: Saved 4 bytes thank to Adnan

\$\endgroup\$
4
  • \$\begingroup\$ Does this also work: žyLçJá9ÝJ'_J? \$\endgroup\$
    – Adnan
    Jul 18 '16 at 21:11
  • \$\begingroup\$ @Adnan: Yes of course :) Much better! \$\endgroup\$
    – Emigna
    Jul 18 '16 at 21:58
  • 1
    \$\begingroup\$ Alternatively žyLçá9Ý'_)˜J also works for the same byte count. \$\endgroup\$
    – Emigna
    Jul 18 '16 at 22:04
  • \$\begingroup\$ Alternatively, žj non-competing. \$\endgroup\$ Jun 16 '17 at 22:05
2
\$\begingroup\$

Golfscript, 18 bytes

10,123,65>'[\]^`'^
\$\endgroup\$
2
\$\begingroup\$

Mathematica, 49 bytes

a=CharacterRange;"_"<>{48~a~57,65~a~90,97~a~122}&

Anonymous function. Takes no input and returns the string "_0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz" as output. Just concatenates a few character ranges.

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

JavaScript, 55 bytes

x=>[...new Set(Object.keys(this).join`j345689`)].join``
  1. The code works correctly only when executed inside the global Firefox browser console (tested with Firefox 47.0 on Linux Mint inside a freshly created profile).
    • To be able to open the console, you first have to set devtools.chrome.enabled to true in about:config. (You can then open it using Ctrl + Shift + J).
  2. Even the most ridiculously small change to the browser will likely break this code. In fact, I'm not sure if it will even work on another operating system.
    • The name of the profile might matter as well. I've named mine Default User.
\$\endgroup\$
2
\$\begingroup\$

Python 2, 62 bytes

r=range
print''.join(map(chr,r(97,123)+r(65,91)+r(48,58)))+'_'

prints:

abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_

This could probably be golfed more but I'm not sure how!

\$\endgroup\$
1
  • 2
    \$\begingroup\$ Since the output can be in any order, try fiddling with combining ranges and using slices. You may be able to shave off a few bytes that way. \$\endgroup\$ Jul 18 '16 at 18:40
2
\$\begingroup\$

Jelly, 14 bytes

“09AZaz_”Or2/Ọ

Try it online!

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

V, 5 bytes

¬ ~Ó×

Try it online!

Explanation

¬ ~                      " Outputs characters in the range " " to `~`
Ó×                       " Removes all non alphanumeric characters
                         " Synonym of vim's :s/\W//g
\$\endgroup\$
2
\$\begingroup\$

R, 40 bytes

Inspired by this answer.

cat(intToUtf8(c(97:122,65:90,48:57,95)))

Try it online!

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

APL (Dyalog Extended), 12 bytes

Full program.

'_',∊⍳¨'zZ9'

Try it online!

⍳¨'zZ9' "ɩndices" until each of the three characters

ϵnlist (flatten)

'_', prepend an underscore

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

NoRAL, 173 169 bytes

psh 0a1a
sto 0100 41
sto 011a 61
orr 0201 0201
jpz 0220
sto 0134 30
inc 0215
inc 0216
dec 0201
inc 0205
inc 0206
inc 0209
inc 020a
dec 0202
jpz 0235
jmp 0203
sto 013e 5f

NoRAL is a toy assembly language I found on Esolangs.org. Let's give it a whirl (using a minimally adapted version of the Python implementation): Try it online!

There's also a browser-based interpreter here if you want to step through the code.

Explanation

Everything in NoRAL is stored in addressable memory, including the output (256 consecutive bytes, displayed as a 32x8 rectangle) and the program itself, which is self-modifying.

# We use two memory locations in the code, 0x0201 and 0x0202, as counters
# Set digit counter to ten (0x0a), letter counter to twenty-six (0x1a)
# The psh instruction pushes something to the stack, which we're not using, so it's
# effectively a no-op
psh 0a1a
# The output section of memory runs from addresses 0x0100 to 0x01ff
# We're going to put A-Z at 0100-0119, a-z at 011a-0133, 0-9 at 0134-013d, and _ at 013e
# Output uppercase and lowercase letter, starting with A (ASCII 0x41) & a (0x61)
# These instructions will be modified later to output the other letters
sto 0100 41
sto 011a 61
# OR digit counter with itself (no-op, but sets the zero flag if counter is zero)
orr 0201 0201
# If the digit counter is now zero, skip next section:
jpc 0220
#     Output digit, starting with 0 (ASCII 0x30)
sto 0134 30
#     Increment memory location and ASCII code in previous statement
inc 0215
inc 0216
#     Decrement digit counter
dec 0201
# Increment letters' memory locations and ASCII codes
inc 0205
inc 0206
inc 0209
inc 020a
# Decrement letter counter
dec 0202
# If letter counter is now zero, skip next instruction:
jpz 0235
#   Jump back to "output uppercase and lowercase letter"
jmp 0203
# Output underscore (ASCII 0x5f)
sto 013e 5f
\$\endgroup\$
2
  • \$\begingroup\$ There's no permalink feature in the interpreter, that's purely awful. \$\endgroup\$
    – user96495
    Aug 22 '20 at 2:45
  • \$\begingroup\$ ...Eh. The thing I found more problematic was that the code disappears out of the input box every time you click Run, but I just kept my code in a text editor and pasted it in whenever I was ready to run it. No big deal. \$\endgroup\$
    – DLosc
    Aug 22 '20 at 2:49
1
\$\begingroup\$

MATL, 20 bytes

95 48:57 65:90t32+vc

Try it online!

This is a very boring and straightforward answer.

\$\endgroup\$
1
  • 1
    \$\begingroup\$ You can replace 95 by '_' or by 95c and then h casts numbers to chars automatically, so you save the final c. Also, you can replace 32+ by ck. And changing the order allows you to remove a space: 65:90tck95c48:57v \$\endgroup\$
    – Luis Mendo
    Jul 18 '16 at 17:58
1
\$\begingroup\$

MSM, 79 bytes

;.;.;.;.;.;.:,,_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789.

There's no shorter way to get all the letters, numbers and the underscore than explicitly writing them down. I also need 62 . commands to concatenate all the chars into a single string. These are generated by starting with a single . (on the very right), duplicating an concatenating (-> ;.) 8 times, splitting into 64 single dots again (-> :) and dropping two of them (-> ,,).

\$\endgroup\$
1
\$\begingroup\$

Java, 106 bytes

String A(char b){String B="_";for(b=48;b++<58;)B+=b;for(b=65;b++<91;)B+=b;for(b=97;b++<123)B+=b;return B;}

Returns _0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz by abusing for-loops.

Making the above function compilable costs 9 bytes, resulting in a 115-byte program:

class a{String A(char b){String B="_";for(b=48;b++<58;)B+=b;for(b=65;b++<91;)B+=b;for(b=97;b++<123)B+=b;return B;}}

The equivalent monolithic program which prints _0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz is 148 bytes long:

interface a{static void main(String[]A){char b;String B="_";for(b=48;b++<58;)B+=b;for(b=65;b++<91;)B+=b;for(b=97;b++<123)B+=b;System.out.print(B);}}

Java (lambda expression), 91 bytes

(b,B)->{B="_";for(b=48;b++<58;)B+=b;for(b=65;b++<91;)B+=b;for(b=97;b++<123)B+=b;return B;};

This is a java.util.function.BiFunction<Character, String, String>.

\$\endgroup\$
5
  • \$\begingroup\$ Maybe it's a bit boring, but just manually printing everything: void f(){System.out.print("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_");} (94 bytes) is shorter in Java. ;) \$\endgroup\$ Jul 19 '16 at 7:08
  • \$\begingroup\$ yay under 100 ''void f(){char c=97;String r="";while(c<='z')r+=c++;System.out.print(r+r.toUpperCase()+"_");} \$\endgroup\$
    – dwana
    Jul 19 '16 at 10:42
  • \$\begingroup\$ 91 my final form, void f(){char c=65;String r="";while(c<=90)r+=c++;System.out.print(r.toLowerCase()+r+"_");} \$\endgroup\$
    – dwana
    Jul 19 '16 at 10:49
  • 1
    \$\begingroup\$ @KevinCruijssen shorter, as function: ()->"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ012345‌​6789_" ("only" 69 bytes). \$\endgroup\$ Jul 19 '16 at 13:43
  • 1
    \$\begingroup\$ 79 void d(){for(char b=1;b<127;b++)System.out.print((b+"").replaceAll("\\W",""));} \$\endgroup\$
    – PeterK
    Jul 20 '16 at 11:18
1
\$\begingroup\$

Japt, 22 bytes

0o#{ £YdÃf@Xf"\\\\w"Ãq

Try it there.

\$\endgroup\$
1
\$\begingroup\$

Jolf, 17 bytes

RψΜz@~dpAHd mHLSE

Try it here!

Explanation

RψΜz@~dpAHd mHLSE
   z@~             range from 1 to 126
  Μ   dpAH         chars of
 ψ        d mHLS   filter all that don't match "\w+" (LS)
R               E  join by ""
\$\endgroup\$
1
\$\begingroup\$

LINQ, 88 bytes

from c in Enumerable.Range(0,123)where char.IsLetterOrDigit((char)c)|c==95 select(char)c

A LINQ expression (OK it is almost C#) where the output is an IEnumerable<char>. You can try it with LinqPad.

\$\endgroup\$
1
\$\begingroup\$

C#, 85 bytes

()=>{var r="_";for(char c='/';c<'z';)r+=char.IsLetterOrDigit(++c)?c+"":"";return r;};

C# lambda where the output is a string.

A full string would be 69 bytes...

Code:

()=>{
    var r="_";
    for(char c='/';c<'z';)
        r+=char.IsLetterOrDigit(++c)?c+"":"";
    return r;
};

Try it online!

\$\endgroup\$
1
\$\begingroup\$

PHP, 60 48 bytes

New version that's much shorter!

<?=preg_replace('/\W/','',join(range(' ','z')));

Try it on Ideone

Inspired by TimmyD's solution. Takes a range of all characters from   to z, joins them into a string, then replaces all characters that match \W (which is any character not specified in this challenge) with nothing.

Old version:

0123456789_<?php for($i=64;++$i<91;)echo chr($i).chr($i+32);

Ungolfed:

0123456789_
<?php 
    for($i=64;++$i<91;) echo chr($i).chr($i+32);

Anything written outside the <?php tag is considered plain text. The for loop in the PHP code echoes the uppercase and lowercase of each letter.

\$\endgroup\$
1
\$\begingroup\$

Brainfuck 36 Bytes (96 commands)

>++++++[-<++++++++>]+++++[<.+.+>-]<+++++++>+++++++++++++[-<.+.+>]<++++.++>+++++++++++++[-<.+.+>]

Explanation:

 >++++++[-<++++++++>]    Increment to '0'
 +++++[<.+.+>-]          Print 10 characters (0 to 9)
 <+++++++>               Increment to lower upper characters
 +++++++++++++[-<.+.+>]  Print 26 characters (A to Z)
 <++++.++>               Increment to '_' Print it and move to a
 +++++++++++++[-<.+.+>]  Print 26 characters (a to z)

EDIT: Most straightforward solution IMHO, still shorter than the others

\$\endgroup\$
1
  • \$\begingroup\$ That's not how we count bytes. In brainfuck, this is a 96-bytes solution, because every command is stored in one byte. You could port it to CompressedFuck though. \$\endgroup\$
    – Dennis
    Jul 20 '16 at 15:43
1
\$\begingroup\$

Common Lisp, 160 bytes

(setq a 47)(loop(setq a(+ a 1))(princ(code-char a))(when(and(> a 56)(< a 64))(setq a 64))(when(and(> a 89)(< a 96))(setq a 96))(when(> a 121)(return)))(princ'_)
\$\endgroup\$
1
\$\begingroup\$

K, 21 bytes

_ci95,(97+!26),65+!26
\$\endgroup\$
1
\$\begingroup\$

O, 40 bytes

[[D2*(,]B6*(+{n.84*+}dC8*(C4*.9+mr]{nc}d
\$\endgroup\$
1
\$\begingroup\$

C--, 230 bytes

target byteorder little;export main;import putchar,isalnum;foreign"C"main(){bits32 v,t;v = 48;T:t=foreign"C"isalnum(v);if (t!=0){foreign"C"putchar(v);}if (v==95){foreign"C"putchar(v);}v=v+1;if (v<123){goto T;}foreign"C"return(0);}

Ungolfed:

target byteorder little;

export main;
import putchar, isalnum;

foreign "C" main(){
    bits32 v, tmp;
    v = 48;
Top:
    tmp = foreign "C" isalnum(v);
    if (tmp != 0){
        foreign "C" putchar(v);
    }

    if (v == 95){
        foreign "C" putchar(v);
    }

    v=v+1;
    if (v < 123) { goto Top; }

    foreign "C" return (0);
}
\$\endgroup\$
1
\$\begingroup\$

Python 2.x, 63 bytes

print''.join(chr(a)for a in range(123)if chr(a).isalnum())+'_'

Try it online.

Explanation:

chr(a)for a in range(123)if chr(a).isalnum() # generates a list iterating through ascii 
                                             #  symbols, picking just numbers alphabet characters

''.join(...)+'_'                             # joins a list of items with no spacing;
                                             # appends '_' at the end

My first golfing attempt; thanks to mbomb007 for the hints

\$\endgroup\$
3
  • \$\begingroup\$ You can remove some spaces. \$\endgroup\$
    – mbomb007
    Jul 19 '16 at 15:51
  • \$\begingroup\$ where for example? I thought I got rid of each one I could \$\endgroup\$
    – harry
    Jul 19 '16 at 17:58
  • \$\begingroup\$ print''.join(chr(a)for a in range(48,123)if chr(a).isalnum())+'_'. Quotes and parentheses/brackets are delimiters. You don't have any, but you can also do something like print 1if 1else 0. See the Tips for golfing in Python page. \$\endgroup\$
    – mbomb007
    Jul 19 '16 at 19:03
1
\$\begingroup\$

Julia, 35 bytes

()->join(['a':'z','A':'Z',0:9,'_'])

Alternative solution, also 35 bytes:

()->replace(join('0':'z'),r"\W","")
\$\endgroup\$
0
1
\$\begingroup\$

SML, 70 (lame) bytes, 80 78 71 64 bytes

I did it! The lame solution has been defeated by 6 bytes:

fun&123="_"| &91= &97| &58= &65| &n=str(chr n)^ &(n+1);print(&48)

Try it online! Better readable:

fun t 123 = "_"
  | t 91  = t 97
  | t 58  = t 65
  | t n   = str(chr(n)) ^ t (n+1);
print(t 48)

Keep reading to see past me whining about not having found this solution yet.


print"_0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"

The sad truth so far: I didn't manage to get something shorter than this, and believe me, I've tried.

Straight forward using build-in functions:

print("_"^implode(List.filter Char.isAlphaNum(List.tabulate(123,chr))))

Generate Char list, filter, implode (char list -> string), add _, print:

_0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz

Uses 71 bytes and is thereby 2 bytes to long to beat the lame solution. As more or less only keywords remain, I'm pretty sure this approach can't be golfed any further.

Let's build our own function!
This approach yielded multiple solutions of which the shortest one

fun&26a=""| &n a=str(chr(n+a))^ &(n+1)a;print(&16 32^ &0 65^ &0 97^"_")

also still needs 71 bytes. At least some a bit more interesting stuff is happening here. Let's name the function f instead of & and have closer look:

1  fun f 26 a = ""
2    | f  n a = str(chr(n+a)) ^ f (n+1) a
3  ;
4  print(f 16 32 ^ f 0 65 ^ f 0 97 ^ "_")
  • 4 f n a returns a string of 26-n consecutive ascii-chars starting at char number a. ^ concats two strings.
  • 1 Pattern matching. If the second argument is 26, return an empty string.
  • 2 Recursion: If n is not yet 26, get the current char, convert it into a string and append it to the (recursively build) rest of the string.
  • 3 Tell the interpreter that we are finished with declaring f so we can use it afterwards.

26-n? Why not do something more intuitive like

fun f 0 a = ""
  | f n a = str(chr(n+a)) ^ f (n-1) a;
print(f 10 47 ^ f 26 64 ^ f 26 96 ^ "_")

, would nobody ask here ever.

Because on the one hand this would print

9876543210ZYXWVUTSRQPONMLKJIHGFEDCBAzyxwvutsrqponmlkjihgfedcba_

which albeit correct doesn't look very nice. However, more importantly in this case we have one 0 and two 26 and in the other case two 0 and one 26, which saves 1 byte.

Nevertheless it's still two bytes to go to underbid the infamous solution. At least for this approach remains a tiny bit of hope to achieve this goal, some time, in a brighter future ...
But probably not.

\$\endgroup\$
2
  • 1
    \$\begingroup\$ There's no lowercase z. Typo? \$\endgroup\$
    – owacoder
    Jul 18 '16 at 18:05
  • 1
    \$\begingroup\$ @owacoder Thanks! That was a typical off-by-one error, as z is char number 122, but List.tabulate has to count to 123 to reach it. \$\endgroup\$
    – Laikoni
    Jul 18 '16 at 18:10
1
\$\begingroup\$

C, 56 55 bytes

i;k(){for(;putchar(i%26+"aA0"[i++/26])^57;);puts("_");}

Output:

abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_
\$\endgroup\$
1
\$\begingroup\$

Lua, 64 Bytes

s="abcdefghijklmnopqrstuvwxyz"print(s..s:upper().."_0123456789")
\$\endgroup\$
4
  • \$\begingroup\$ I tried your code with this and it doesn't print numbers. \$\endgroup\$
    – user65167
    Feb 10 '17 at 19:53
  • \$\begingroup\$ @PrzemysławP Just ran it in the demo environment and it ran just fine (printing out abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_) \$\endgroup\$
    – Katenkyo
    Feb 14 '17 at 15:23
  • \$\begingroup\$ Yes, but question was to output also 0123456789, right? \$\endgroup\$
    – user65167
    Feb 14 '17 at 15:42
  • 1
    \$\begingroup\$ @PrzemysławP Wow, how did I missed that ?! Thanks, it's fixed now, it should be printing abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_0123456789 \$\endgroup\$
    – Katenkyo
    Feb 14 '17 at 16:05
1
\$\begingroup\$

SmileBASIC, 52 bytes

FOR I=65TO 90?CHR$(I);CHR$(I+32);
NEXT?1234567890;"_
\$\endgroup\$

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.