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
...
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 ...
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
...
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.
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.
>&...
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 ...
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 ...
73
votes
62
votes
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 ...
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!
...
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 ...
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 ...
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)
<...
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 ...
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:
...
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!...
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 ...
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:
...
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 ...
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:
...
42
votes
Inverse function
APL, 3 bytes
*⊣⍟
This is a function train. Monadic * returns e^x, monadic ...
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]...
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....
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 ...
41
votes
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 ...
38
votes
Accepted
Coding Around The Clock
GolfScript, 11 10 bytes
21;;3#9];6
Uses # as padding character.
12 o'clock
...
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 ...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
source-layout × 190code-golf × 119
code-challenge × 48
string × 36
quine × 27
restricted-source × 18
printable-ascii × 14
cops-and-robbers × 13
kolmogorov-complexity × 11
popularity-contest × 10
hello-world × 9
radiation-hardening × 8
number × 7
permutations × 6
math × 5
integer × 5
primes × 5
whitespace × 5
decision-problem × 4
palindrome × 4
multiple-holes × 4
self-scoring × 4
matrix × 3
polyglot × 3
code-bowling × 3