234 questions linked to/from Tips for golfing in Python
17k views

### Simple cat program

One of the most common standard tasks (especially when showcasing esoteric programming languages) is to implement a "cat program": read all of STDIN and print it to STDOUT. While this is named after ...
5k views

### How far should I sum?

How far should I sum? The harmonic series is the "infinite sum" of all the fractions of the form $\frac1n$ for $n$ positive integer. I.e. the harmonic series is \frac11 + \frac12 + \frac13 + \...
283 views

### Composition of permutations – the group product

Given two permutations in disjoint cycle form, output their product/composition in disjoint cycle form. To find the composition, convert the disjoint cycles to permutations in two-line notation. Each ...
53k 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 ...
2k views

### Find the number of integers in the range from 1 to N that ends with 2

Task As input you have: a positive integer N And you should output: The number of integers in $[1,N]$ (an inclusive range) which end with the digit $2$ in ...
4k views

### This highway needs rain across both of its lanes

In this challenge you will take a an ascii art image of a highway like so ...
2k views

### Connect Four Validator

Introduction Connect Four is a game where you attempt to get four in a row: horizontally, vertically, or diagonally. In this code golf, we will be trying to find who won, given a game board. There ...
26k 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 ...
11k views

### N(e(s(t))) a string

To "function nest" a string, you must: Treat the first character as a function, and the following characters as the arguments to that function. For example, if the input string was ...
2k views

### Summing a sub-square of a quarter of an infinite chessboard

Description of the problem Imagine a quarter of an infinite chessboard, as in a square grid, extending up and right, so that you can see the lower left corner. Place a 0 in there. Now for every other ...
9k views

### Tips for golfing in <all languages>

The aim of this post is to gather all the golfing tips that can be easily applied to <all languages> rather than a specific one. Only post answers that its ...
7k views

### Convert YYYYMM to MMMYY

Basing on this SO question. Challenge is rather simple: given a date period in the format YYYYMM output it in the format MMMYY. ...
22k views

### It took me a lot of time to make this, pls like. (YouTube Comments #1)

Hold up..... this isn't trolling. Background These days on YouTube, comment sections are littered with such patterns: ...