Communities

Writing
Writing
Codidact Meta
Codidact Meta
The Great Outdoors
The Great Outdoors
Photography & Video
Photography & Video
Scientific Speculation
Scientific Speculation
Cooking
Cooking
Electrical Engineering
Electrical Engineering
Judaism
Judaism
Languages & Linguistics
Languages & Linguistics
Software Development
Software Development
Mathematics
Mathematics
Christianity
Christianity
Code Golf
Code Golf
Music
Music
Physics
Physics
Linux Systems
Linux Systems
Power Users
Power Users
Tabletop RPGs
Tabletop RPGs
Community Proposals
Community Proposals
tag:snake search within a tag
answers:0 unanswered questions
user:xxxx search by author id
score:0.5 posts with 0.5+ score
"snake oil" exact phrase
votes:4 posts with 4+ votes
created:<1w created < 1 week ago
post_type:xxxx type of post
Search help
Notifications
Mark all as read See all your notifications »

Search

Advanced Search Options

To further refine your search, you can use additional qualifiers such as score:>0.5. For example, the search score:>=0.5 created:<1y grammar would return only posts mentioning "grammar" that have a score >= 0.5 and were created less than a year ago.

Further help with searching is available in the help center.

Quick hints: tag:tagname, user:xxx, "exact phrase", post_type:xxx, created:<N{d,w,mo,y}, score:>=0.5

Filters
1.6k posts
 
66%
+2 −0
Challenges It's Hip to be Square

Python 3, 46 bytes Saved 8 bytes thanks to Shaggy! lambda n:[n-i*i or exit(1)for i in range(1+n)] Try it online! Python 3.8 (pre-release), 50 54 52 bytes Fixed a silly mistake thanks to Sh...

posted 3y ago by user‭  ·  edited 3y ago by user‭

Answer
66%
+2 −0
Q&A Tips for golfing in Python

Reorder expressions in order to save whitespace Consider the following code: if c=='U':c='X' The space between if and c obviously cannot be removed, as that would merge them to the identifier ...

posted 3y ago by celtschk‭  ·  edited 3y ago by celtschk‭

Answer
66%
+2 −0
Challenges Decode periodic decimal fractions

Haskell, 352 bytes f a=let{(d,e)=y$filter(>'-')a;f=drop 1e;g=0!h;h=fst n;i=scanr(:)[]h;(j,k)=elem '.'f%(1!head(filter(\a->a>[]&&elem(a++a)i)i++[[last$'0':h]]));(l,m)=(read('0':d...

posted 3y ago by Hakerh400‭  ·  edited 3y ago by Hakerh400‭

Answer
66%
+2 −0
Challenges Decode periodic decimal fractions

JavaScript (Node.js), 242 234 bytes s=>([l,p,i,j,_,r]=/(-)?\+?(\d*)\.?(\d*?)(((\d+)\6|\d)\.|$)/.exec(s),[i,r]=c(c([i|0,1],[j|0,10**(l=j.length)]),[r=r||'0',10**l*(10**r.length-1)]),[(p?-i:i)/(j...

posted 3y ago by Moshi‭  ·  edited 3y ago by Moshi‭

Answer
66%
+2 −0
Challenges Collatz conjecture; Count the tries to reach $1$

Japt, 15 bytes É©Òß[U*3ÄUz]gUv Try it É©Òß[U*3ÄUz]gUv :Implicit input of integer U É :Subtract 1 © :Logical AND with Ò :Negate the ...

posted 3y ago by Shaggy‭  ·  edited 3y ago by Shaggy‭

Answer
66%
+2 −0
Challenges Collatz conjecture; Count the tries to reach $1$

BQN, 31 28 bytes {1+(1≠𝕩)◶¯1‿𝕊2(|⊑÷˜∾1+3×⊢)𝕩} Try it online! An anonymous function which takes a number. the ¯1 branch is a bit tacky but saves a byte over (1+𝕊).

posted 3y ago by Razetime‭  ·  edited 3y ago by Marshall Lochbaum‭

Answer
66%
+2 −0
Challenges Weave Strings Together

Python 3, 72 69 bytes lambda l:''.join(sum(zip(*[[*i]+['']*max(map(len,l))for i in l]),())) Try it online! Uses this method to flat zip, with modifications to pad the shorter lists.

posted 3y ago by Moshi‭  ·  edited 3y ago by Moshi‭

Answer
66%
+2 −0
Challenges Weave Strings Together

Python 2, 58 54 bytes lambda l:''.join(filter(None,sum(map(None,'',*l),()))) Try it online! Amazingly, shorter than my Python 3 answer! Uses this method to zip unequal-length lists and this me...

posted 3y ago by Moshi‭  ·  edited 3y ago by Moshi‭

Answer
66%
+2 −0
Challenges Weave Strings Together

Ruby, 51 bytes ->a{(0..a.map(&:size).max).map{|n|a.map{_1[n]}}*""} ->a{ } # lambda taking array `a` (0..a.map(&:size).max) ...

posted 3y ago by snail_‭  ·  edited 3y ago by snail_‭

Answer
66%
+2 −0
Challenges 99 Shortened Bottles of Beer

FALSE, 198 bytes [" on the wall"]c:[$." bottle"$1=~["s"]?" of beer"]b:99[$1>][b;!c;!", "b;!". Take one down, pass it around, "1-b;!c;!". "]#1b;!" on the wall, "1b;!". Go to the store and b...

posted 3y ago by matt‭

Answer
66%
+2 −0
Challenges Weave Strings Together

Scala, 60 bytes _.map(_ map "".+).reduce(_.zipAll(_,"","")map(_+_)).mkString Try it in Scastie! First, _.map(_ map "".+) turns every string into a list of strings containing a single character...

posted 3y ago by user‭

Answer
66%
+2 −0
Challenges Reverse your quine

Challenge Write a program that prints its reversed self. For example, if your code is foo() Then it'll output: )(oof Make sure that the quine is a valid one, as defined here: No cheatin...

4 answers  ·  posted 3y ago by General Sebast1an‭  ·  last activity 3y ago by celtschk‭

Question code-golf quine
66%
+2 −0
Challenges Reverse your quine

Vyxal D, 10 bytes `:qpṘ`:qpṘ Try it Online! `:qp `:qp # Standard quine structure Ṙ Ṙ # Reverse Or, more interestingly... Vyxal D, 31 bytes `q\`:Ė#\`+øm`:Ė#Ė:`mø+`\#Ė:`\q` Try ...

posted 3y ago by A username‭

Answer
66%
+2 −0
Challenges Reverse your quine

Python 3, 69 bytes i="))43,]1-::[i,43,73(%ci(tnirp;%c%s%c=i";print(i%(37,34,i[::-1],34)) Try it online!

posted 3y ago by celtschk‭

Answer
66%
+2 −0
Challenges 99 Shortened Bottles of Beer

Python 3, 202 bytes a,i='bottle%s of beer on the wall',99 while i:i-=1;x=a%'s'[:i];print(i+1,x+',',i+1,x[:-12]+'.\n'+'GToa kteo otnhee dsotwonr ea nadn dp absusy isto maer omuonrde,,'[i>0...

posted 3y ago by Endercraft2319‭

Answer
66%
+2 −0
Challenges Repeat the characters

Python 3, 34 bytes lambda a,b:''.join(b*i for i in a) Try it online!

posted 3y ago by Endercraft2319‭  ·  edited 3y ago by Endercraft2319‭

Answer
66%
+2 −0
Challenges Caesar shift cipher

Python 3.8 (pre-release), 98 bytes lambda s,n:''.join((c,chr((ord(c)+n-1-(o:=(64,96)[c.islower()]))%26+o+1))[c.isalpha()] for c in s) Try it online!

posted 3y ago by Endercraft2319‭

Answer
66%
+2 −0
Challenges The Ludic Numbers

Sclipting, (UTF-16) 58 52 bytes 가匱❸增平갠下氫終要鈮貶⓶梴감⓶上❸乘殲終終并鈮掘增 Gives the nth ludic number, 0-indexed. 가 Start list of Ludics with 0 匱❹增平갠下氫終 Create a list of numbers from 2 to n+1 squared 要 W...

posted 3y ago by Moshi‭  ·  edited 3y ago by Moshi‭

Answer
66%
+2 −0
Challenges The Ludic Numbers

Python 3, 80 77 75 72 bytes def f(): yield 1;l=[*range(2,236425)] while l:yield l[0];del l[::l[0]] Try it online! Prints out the whole sequence. I did my best to get the biggest number t...

posted 3y ago by General Sebast1an‭  ·  edited 3y ago by General Sebast1an‭

Answer
66%
+2 −0
Challenges Reverse an ASCII string

Haskell, 7 bytes reverse Try it online!

posted 3y ago by carmysilna‭

Answer
66%
+2 −0
Challenges Define a mathematical expression in English

C (gcc), 774 bytes #define S strcat(o, #define I(s)if(n)S s);else{S" ");return;} #define B);break;case n,N,s;char*i,o[999],*d[]={"zero ","one ","two ","three ","four ","five ","six ","seven "...

posted 3y ago by celtschk‭

Answer
66%
+2 −0
Challenges Encode and decode floating point integers

Haskell, 219 194 bytes h!n=x n?(a?c$d>n&&(even a?f(<)$f(==)))$h where(a,b)=e!!(c-1);(c,d)=dropWhile((<n).snd)e!!0;f g=g(n*2)$b+d x n=m?(2^(e-1)*(m+32))$e<1where(e,m)=divMod ...

posted 3y ago by Hakerh400‭  ·  edited 3y ago by Hakerh400‭

Answer
66%
+2 −0
Challenges Find good coalitions

Python 3, 191 bytes lambda p:[c for c in chain(*[C(p,r)for r in range(len(p)+1)])if all(all(i==(sum(p.values())/2>=sum(p[n]for n in d))for d in C(c,len(c)-i))for i in[0,1])] from itertools imp...

posted 3y ago by Moshi‭  ·  edited 3y ago by Moshi‭

Answer
66%
+2 −0
Challenges Convert integer to English

Python 3, 399 bytes def f(n): if n<1:return'zero' t=1000;m=t*t;r='r fif six seven eigh nine ';b=f'one two three four five six seven eight nine ten eleven twelve thir fou{r}twen thir fo{r}'....

posted 3y ago by Moshi‭

Answer
66%
+2 −0
Challenges Just the vowels please

Vyxal, 3 bytes k∨↔ Try it Online! ↔ # Keep chars from k∨ # vowels

posted 2y ago by A username‭

Answer