Linked Questions
85 questions linked to/from Tips for golfing in PowerShell
203
votes
436
answers
84k
views
1, 2, Fizz, 4, Buzz
Introduction
In our recent effort to collect catalogues of shortest solutions for standard programming exercises, here is PPCG's first ever vanilla FizzBuzz challenge. If you wish to see other ...
341
votes
184
answers
155k
views
Tips for golfing in Python
What general tips do you have for golfing in Python? I'm looking for ideas which can be applied to code-golf problems and which are also at least somewhat specific to Python (e.g. "remove comments" is ...
390
votes
156
answers
295k
views
Write a program that makes 2 + 2 = 5 [closed]
Write a program that seemingly adds the numbers 2 and 2 and outputs 5. This is an underhanded contest.
Your program cannot output any errors. Watch out for memory holes! Input is optional.
...
150
votes
349
answers
35k
views
Shortest code to produce infinite output
Write the shortest code you can that produces an infinite output.
That's all. You code will only be disqualified if it stops producing output at some point. As always in code golf, the shortest code ...
240
votes
115
answers
45k
views
Print every character your program doesn't have
Your task is to build a program (using only printable ASCII characters and/or tabs and newlines) that prints out exactly the characters in the printable ASCII space (...
395
votes
50
answers
60k
views
Covfefify a string
In this challenge, you must take a string matching the regex ^[a-zA-Z]+$ or whatever is reasonable (you don't have to consider uppercase or lowercase letters if you ...
232
votes
67
answers
20k
views
No A, just CAPS LOCK
What happens when the CapsLock key on your keyboard doesn't have a notch in it?
"This hPPENS."
The goal of this program is to consistently emulate keyboard misses where each A press is replaced with ...
87
votes
149
answers
15k
views
Collatz Conjecture (OEIS A006577)
This is the Collatz Conjecture (OEIS A006577):
Start with an integer n > 1.
Repeat the following steps:
If n is even, divide it by 2.
If n is odd, multiply it by 3 and add 1.
It is proven that for ...
51
votes
104
answers
6k
views
Division and remainder
This challenge, while probably trivial in most "standard" languages, is addressed to those languages which are so esoteric, low-level, and/or difficult to use that are very rarely seen on this site. ...
48
votes
105
answers
18k
views
Draw an ASCII chess board!
Here is a simple challenge for you: You must produce this ASCII representation of a chess board. White is represented by uppercase characters, and black is represented by lowercase. Empty tiles are ...
59
votes
84
answers
9k
views
How to randomize letters in a word
According to some controversial story, the odrer of ltteres in a wrod deos not mttaer much for raednig, as lnog as the frist and lsat lteter macth with the orignial wrod.
So, for fun, what would be ...
57
votes
83
answers
9k
views
Test a number for narcissism
A Narcissistic Number is a number which is the sum of its own digits, each raised to the power of the number of digits.
For example, take \$153\$ (3 digits):
\$1^3 + 5^3 + 3^3 = 153\$
\$1634\$:
\$1^...
53
votes
77
answers
8k
views
Output the alphabet, the ALPHABET, or just a character
The challenge is simple:
Write a function or program that takes an input x, and outputs the lower case alphabet if x is part of ...
67
votes
52
answers
9k
views
Increment The Time
Every digital clock contains a small creature that has to advance the time every minute [citation needed]. Due to the popularty of digital clocks and the popularity of catching them in the wild, they ...
48
votes
71
answers
9k
views
List of possible birth years of living humans
The Challenge
Output a list of years that starts with the current year and ends 120 years ago. The birth year of every living human would be included in this list.
Details
The list should be in ...