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
 
66%
+2 −0
Challenges Repeat the characters

Jelly, 1 byte x Try It Online! x is Jelly's replicate atom. Since Jelly is inspired by languages like J, APL, etc, it is no surprise that is has an atom for a fairly important function.

posted 3y ago by hyper-neutrino‭

Answer
66%
+2 −0
Challenges Repeat the characters

jq, 32 27 bytes -5 bytes (thank you Razetime) .n as$n|.s/""|map(.*$n)|add Try it online!

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

Answer
66%
+2 −0
Challenges Repeat the characters

C (gcc), 56 bytes i;f(s,n)char*s,n;{for(;*s;s++)for(i=n;i--;putchar(*s));} Try it online! My attempt at recursion ended up at 61 bytes: o;f(s,n)char*s,n;{for(o=n;*s&&n--;putchar(*...

posted 3y ago by Lundin‭

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

Replace range() if $n < 4$ If you're using a for loop, you're probably using range() for the list count. You can actually replace it if the number inside range() is less than 4. Why? Examine th...

posted 3y ago by General Sebast1an‭

Answer
66%
+2 −0
Challenges Repeat the characters

Japt -m, 2 bytes pV Try it pV :Implicit map of first input string p :Repeat V :Second input times

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

Answer
66%
+2 −0
Challenges Repeat the characters

JavaScript, 36 bytes s=>n=>s.replace(/./g,`$&`.repeat(n)) Try it online!

posted 3y ago by Shaggy‭

Answer
66%
+2 −0
Challenges Repeat the characters

Rockstar, 90 bytes listen to S split S listen to N O's"" while S roll S into C let C be*N-0 let O be+C say O Try it here - code will need to be pasted in; s goes on the first line of ...

posted 3y ago by Shaggy‭

Answer
66%
+2 −0
Challenges Expand a polynomial

Vyxal, 2 bytes ∆ṙ Try it Online! That cheap builtin.

posted 3y ago by emanresu A‭

Answer
66%
+2 −0
Challenges Expand a polynomial

Japt -Q, 15 12 bytes à üÊËx_×*JpE -3 bytes thanks to @Shaggy Uses Vieta's. Try it

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

Answer
66%
+2 −0
Challenges Abbreviate everything

JavaScript (Node.js), 91 68 65 bytes s=>s.toUpperCase().match(/(?<=^| )[A-Z]|:|;|(?<=[.?!]) /g).join`` Assumes that the original text is properly formatted (has a space after punctuati...

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

Answer
66%
+2 −0
Challenges Create an Alphabet Diamond

Python 3, 99 bytes r=[*range(26)] a="ABCDEFGHIJKLMNOPQRSTUVWXYZ" for i in r+r[-2::-1]:print(" "*(26-i)+a[:i]+a[i::-1]) Try it online!

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

Answer
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

Combine loops Suppose you have a for loop in another, maybe a couple of times, and nothing else inside of the outer for loops (except for the first for loop since anything outside won't be involve...

posted 3y ago by General Sebast1an‭

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

* == and If you want to check if two booleans or integers and want to check if both of them are true in an if statement, then you can leave out and to replace it with *: x=2;y=3 if x and y:pri...

posted 3y ago by General Sebast1an‭

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

Use a+=[b] instead of a.append(b) The title says it all. a=[];b=10;print(a) a+=[b];print(a) Try it online!

posted 3y ago by General Sebast1an‭

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
Q&A Tips for golfing in Python

Replace if/else expressions by array subscripts Consider the statement a=b if x<y else c You can get rid of the expensive keywords by using the implicit conversion of boolean values to inte...

posted 3y ago by celtschk‭

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

Replace n+1 with -~n and n-1 with ~-n For integers, n+1 and ~-n have the same value, as have n-1 and -~n. While the expressions themselves have the same lengths, the replacements often allow to s...

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

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