223 votes

Hyperprogramming: N+N, N×N, N^N all in one

Jelly, 12 bytes N+N “(ẹ+)‘FQṖṪỌv Try it online! N×N ““((ẹẹ++))‘‘FFQQṖṖṪṪỌỌvv Try it online! N^N ...
Dennis's user avatar
  • 209k
212 votes

Hello, World! (Every other character)

Python 3, 61 bytes rant="partisn't" print(("HHeelllloo,, WWoorrlldd!!"""[::2])) Try it online! Abusing the fact that print ...
vroomfondel's user avatar
  • 2,254
170 votes

I double the source, you double the output!

Python 2, 33 bytes print len(open(__file__).read())# Try it online! Try it doubled Python 3, 28 bytes ...
Wheat Wizard's user avatar
  • 95.5k
105 votes

I double the source, you double the output!

Jelly, 1 byte Try it online! or Try it double! I have no idea how this works, but apparently it does.
DJMcMayhem's user avatar
  • 58.7k
93 votes

Hyperprogramming: N+N, N×N, N^N all in one

><>, 41 bytes \< 1:: : &&* + i*n n c& %: 4l 0( .i n} &? Try it online: N+N, N*N, N^N. Assumes that the STDIN input is exactly one char. >&...
Sp3000's user avatar
  • 61.7k
84 votes

I double the source, you double the output!

Google Sheets, 5 Bytes Anonymous worksheet formula that takes no input and outputs into the cell which holds the formula =4/(2 As a single formula this evaluates ...
Taylor Alex Raine's user avatar
75 votes

Inverse function

Haskell, 11 bytes f=log pxe=f and in reverse order: f=exp gol=f This works without the "comment" trick. Instead each ...
nimi's user avatar
  • 35.8k
73 votes

What did we forget?

zsh, 603 594 566 561 548 440 415 399 378 370 bytes ...
Doorknob's user avatar
  • 71.4k
62 votes

Source Code Metamorphosis

Befunge-98, 602 bytes ...
PurkkaKoodari's user avatar
62 votes

Hello, World! (Every other character)

Cardinal, 29 bytes % " H e l l o , W o r l d ! Try it online! Removing every other character removes all the linefeeds, which still results in ...
Martin Ender's user avatar
59 votes

From Programming Puzzles to Code Golf

Python 2, 48 47 bytes -1 byte thanks to Erik the Outgolfer print' 'and'Programming Puzzles'or'Code\40Golf' Try it online! ...
Rod's user avatar
  • 18.4k
58 votes

Code close to the challenge: Sum of integers

Python, distance 3 #Given a set of integers, find the sum#of all integers in it. This gives the built-in function sum, which ...
xnor's user avatar
  • 144k
55 votes

Code close to the challenge: Sum of integers

Julia, distance 27 26 No comments! Given(a)=(Set;of;integer; find; [sum(a),all,integer,in][1]) This creates a function called ...
Alex A.'s user avatar
  • 24.6k
53 votes

I reverse the source code, you negate the output!

05AB1E, 2 bytes (1 Try it online! !enilno ti yrT ( # negate nothing 1 # push 1 (and implictly output it) <...
Grimmy's user avatar
  • 15.6k
52 votes

Hello, World! (Every other character)

C, 125 bytes xpxuxtxs( ) { }xuxs ( ) { } main( ) {puts ( "Hello, World!" ) ; } mxaxixn ( ) {xpxuxtxs ( " H e l l o , W o r l d ! " ) ; } Try it online! With ...
Steadybox's user avatar
  • 16.5k
52 votes

I double the source, you double the output!

C (gcc), 37 bytes i;main(){putchar(i+49);}/* i=1;//*/// The file does not contain a trailing newline. Doubled version, for syntax highlighting: ...
Doorknob's user avatar
  • 71.4k
51 votes

I double the source, you double the output!

Python 2, 21 bytes +1 if id:id=0;print 1 Try it online! Doubled: +1 if id:id=0;print 1+1 if id:id=0;print 1 Try it online!...
xnor's user avatar
  • 144k
48 votes

I double the source, you double the output!

05AB1E, 2 bytes Original XO Try it online! Doubled XOXO Try it online! Explanation X pushes 1 to the stack. O sums the ...
Emigna's user avatar
  • 52.9k
47 votes

I double the source, you double the output!

Hexagony, 7 bytes /)!@.). Prints 1 regularly then 2 doubled. Try it online! or Try it doubled online! Expanded versions: Regular: ...
FryAmTheEggman's user avatar
47 votes

I uppercase the source code, you reverse the input!

05AB1E, 1 byte r Try it online lowercase or uppercase! Finally a question which I (a dumb brain) can answer! Thanks for this easy, yet fun challenge! (I do feel ...
SunnyMoon's user avatar
  • 2,679
42 votes

Build a twisted "Hello world!"

Python 2, 59 bytes print " Hello, world!"[ 2::] #rint "T w i s t e r !"[ ::2] Twisted: ...
PurkkaKoodari's user avatar
42 votes

Inverse function

APL, 3 bytes *⊣⍟ This is a function train. Monadic * returns e^x, monadic ...
marinus's user avatar
  • 31.2k
42 votes

What are the five most powerful characters in your language?

Python3, 21 27 values Characters: 3479% Unique numbers: [1,2,3,4,5,6,7,8,9,11,12,19,20,21,24,29,34,35,36,37,39,43,46,47,49,73,74]...
Yytsi's user avatar
  • 3,762
42 votes

I uppercase the source code, you reverse the input!

Python 3,  61 50 49  48 bytes -1 thanks to benrg! r=-1;ʳ=1;ᵖʳᵢⁿᵗ(ᵢⁿᵖᵘᵗ()[::r]) lower-cased / upper-cased This works because PEP-3131 was implemented in Python 3....
Jonathan Allan's user avatar
41 votes

I double the source, you double the output!

Braingolf, 1 byte + Try it online! Now we're talkin'! Outputs 20, or 40 when source is ...
Mayube's user avatar
  • 11.6k
41 votes

Code 3k to Codee k

Mathematica, 2 bytes 4! 4! returns 24 4!! returns 8
ZaMoC's user avatar
  • 24.3k
41 votes
Accepted

Create a square of increasing size by replicating the initial code

Pyth, 2 bytes 5 Try it online! Also Try it doubled, tripled! How does that work? \n is the command that prints its ...
Mr. Xcoder's user avatar
  • 42.3k
38 votes
Accepted

Coding Around The Clock

GolfScript, 11 10 bytes 21;;3#9];6 Uses # as padding character. 12 o'clock ...
Dennis's user avatar
  • 209k
38 votes

Letter, Number, Symbol, Space, Repeat

Haskell 300 bytes This code should have no trailing newline. The function m1 takes the input as a Char and returns the answer ...
Ørjan Johansen's user avatar

Only top scored, non community-wiki answers of a minimum length are eligible