Posts by General Sebast1an
Binary and code plastered a lot One of the more generic ways of adding design to a code challenge site. The binary digits can be plastered around the header in a way that it looks cryptic. But bin...
Python 3, 183 181 175 bytes def f(a,b): c=a;a=str(a) for i in range(b): y=0;z=9 for j in range(len(a)): if y<int(a[j]):y=int(a[j]) if z>int(a[j]):z=int(a[j]) c=int(a)+...
Assign floats while leaving out zeroes Python allows such strange assignment. You can save bytes by removing the number preceding . if it's only 0: i=.5 print(i) Try it online! The same g...
Lua, 32 bytes print(string.reverse(io.read())) Try it online! Noice built-in.
Lua, 41 40 bytes x=0 y=1while""do print(x)x=x+y y=y+2 end Try it online!
Lua, 51 bytes P1: print("print(tonumber(io.read())+"..io.read()..")") Try it online! P2 (given I inputted 10, 29 bytes): print(tonumber(io.read())+10) Try it online!
Renaming functions A funny, cool, and useful trick. If you have to write a single function multiple times (usually range() on for loops), then you can simply assign a variable by the function's na...
Convenient whitespace removal Here are instances where you can remove whitespace: Strings If you assigned or printed a string, then the next supposed line of code can lean on the right double-qu...
C (clang), 206 bytes main(i){char*s="YWUSQOMKIGECABDFHJLNPRTVXZ";for(i=13;i>0;printf("%c%c%c%c%c%c%c%c%c%c%c%c%c%c\n",s[-1+i],s[0+i],s[1+i],s[2+i],s[3+i],s[4+i],s[5+i],s[6+i],s[7+i],s[8+i],s[...
I'm bored. Let's do something. lmao While I was Somewhere Else, I went to make suggestions for designs on their sites, and no impact really occured. However, since I'm now a Codidactian (not a Cod...
Use lambdas instead of functions At most times, lambdas tend to make smaller code, which is helpful in golfing. Assigning a lambda is easy, just do: lambda f:whatever There are many answers th...
import* You can import some libraries and if you find yourself using: from lib import * Remove the space between import and *, because it works for whatever reason.
Combine conditionals Python has its fair share of comparison operators and can actually be used in a single conditional. For example: x == 2 and y == 2 can be: x==y==2 Used on Make $2 + 2 ...
Replace for loops with string multiplication Let's say we have: for i in range(6):print(end="#") Try it online! This basically outputs # 6 times, which is self-explanatory in the code itsel...
jq --null-input --raw-output, 15 bytes "Hello, World!" Try it online! They kept saying that jq is the language of September 2021. Still surprised no one even made a Hello, World! on it.
Challenge Make a program that takes input of an integer that's $n > 1$ and print out a staircase using a specific character for stair basing (hashes (#) for demonstration; you can use spaces,...
Remove print's parentheses when it's a single string print strangely works without parentheses, however, it only applies to single strings. In other words, it can't do the same for other variables...
Python 3, 349 261 160 bytes a="re y gree br sc bla oc pe rub ol v f li go ch m cre cri si ro a le rus grey pu w pi or blu".split() def f(b):return[j for i in a for j in b if j[:len(i)]==i] T...
C (clang), 116 102 bytes j,k;f(i){for(j=i;j--;printf("#"));for(j=i-1;j--;printf("#"))for(k=i-2,printf("\n#");k--;printf(" "));} Try it online! Sometimes, it's better to use functions when yo...
Lua, 126 118 bytes p=print for i=1,100 do if i%15==0 then p"FizzBuzz"elseif i%3==0 then p"Fizz"elseif i%5==0 then p"Buzz"else p(i)end end Try it online!