Linked Questions

255
votes
145answers
81k 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 ...
97
votes
234answers
15k views

Output with the same length as the code

In this challenge, you should write a program or function which takes no input and prints or returns a string with the same number of bytes as the program itself. There are a few rules: You may only ...
39
votes
100answers
5k views

Divisibility test

Task Given two strictly positive integers n and d as input, determine whether n is evenly divisible by d, i.e., if there exists an integer q such that n = qd. You ...
32
votes
54answers
3k views

Compute the Median

Challenge Given a nonempty list of real numbers, compute its median. Definitions The median is computed as follows: First sort the list, if the number of entries is odd, the median is the value in ...
49
votes
32answers
7k views

Print the Oscars Best Picture Winner

This challenge is in tribute to the winner of Best Picture at the Oscars 2017, La La Land Moonlight! Your challenge is to print the text La La Land pause one second, then change the text to show La ...
58
votes
19answers
5k views

Tips for golfing in R

I'm looking for tips for golfing in the R statistical language. R is perhaps an unconventional choice for Golf. However, it does certain things very compactly (sequences, randomness, vectors, and ...
47
votes
32answers
7k views

Very Simple Triangles

Write a program or function that takes in a positive integer (via stdin, command line, or function arg) and prints or returns a string of that many of these small triangles tiled together, alternating ...
91
votes
10answers
4k views

Write a Programming language of Unknown Completeness

Determining whether a Language is Turing Complete is very important when designing a language. It is a also a pretty difficult task for a lot of esoteric programming languages to begin with, but lets ...
18
votes
47answers
3k views

Robbers - square times square root

Task: Crack the scrambled code for multiplying the square root of an integer n by the square of it! You must post a comment in the cops' thread with a link to your working source, mentioning clearly ...
20
votes
18answers
2k views

Find an Unrelated Number

Given 2 non-negative integers as input, output a non-negative integer that cannot be created through any mathematical operators on the 2 inputs. For example, given inputs ...
14
votes
9answers
3k views

Closest 7-Distinct-Prime Product

(via chat) The OEIS entry A123321 lists the sequence of numbers that are the product of seven distinct primes. For brevity, we'll call this a 7DP number. The first few numbers and their corresponding ...
23
votes
1answer
709 views

Find the Fibonacci Kernel

You've probably heard of the Fibonacci numbers; they're pretty famous. Each number in the Fibonacci sequence is the sum of the last two in the sequence with the first and second numbers being 1. The ...
-1
votes
3answers
249 views

Ghost in the shell [duplicate]

In honor to the 1995 classic Ghost In The Shell (who's live action remake was released today) I propose a challenge where you create a shell with a ghost in it. The challenge: Create a REPL shell ...