224
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 ...
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.
>&...
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
63
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!
...
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 ...
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
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 ...
38
votes
Powerprogramming: O(1^N), O(N^1), O(2^N), O(N^2) all in one
Python 3, 102 bytes
try:l=eval(input());k=1#)]0[*k**l(tnirp
except:k=2#2=k:tpecxe
print(k**l*[0])#1=k;))(tupni(lave=l:yrt
Try it online!
This is of O(1^n), ...
37
votes
Program template for printing *any* string
Excel, 1 byte
'
Ungolfed version
' <-- print the following text,
and exit the current formula
37
votes
2 Cats in a Quine
V, 2 + 2 == 4 bytes
2i2i
Try the quine!
Try the cat!
A is 2i
B is also 2i
How does it ...
36
votes
36
votes
Hello, World! (Every other character)
Actually, 2 bytes
HH
Explanation:
H, as you might expect, pushes Hello, World! to the ...
36
votes
Code 3k to Codee k
Many languages, 4 bytes
16-1
Outputs 15.
16-11
Outputs 5.
This is a CW answer for many languages it works for. Edit to ...
Community wiki
35
votes
Internal Truth Machine
Python 3, 29 bytes
or~print(0)
while 1:print(1)
A full program, which if prefixed with 0 will print ...
34
votes
34
votes
What are the five most powerful characters in your language?
Python, 18 numbers
237#-
Produces as valid results:
1, 2, 3, 4, 5, 7, 16, 23, 24, 25, 27, 32, 35, 37, 69, 71, 72, 73
EDIT: ...
34
votes
What are the five most powerful characters in your language?
05AB1E, 27 38 41 numbers
4·>Ìn
Generates the unique numbers:
...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
source-layout × 189code-golf × 118
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