Posts by General Sebast1an
Ruby, 24 21 18 bytes p"Hello, #{gets}!" Try it online! Golfed down 3 bytes thanks to @snail_'s advice. Golfed down 3 bytes thanks to @south's advice.
Remove ?> You can save 2 bytes by removing the syntax that ends the PHP script when you don't need it. The program will still work. <?php echo"Hello!"; Try it online!
This is a list of golfing tips for the language known as Philippine Peso PHP. If you have a tip, add it in!
PHP, 69 37 bytes <?=($y=sqrt($x=fgets(STDIN)))*$y==$x; Try it online! Golfed 32 bytes thanks to @Shaggy's advice.
PHP, 58 28 bytes P1: <?="<?=\$argv[1]+$argv[1];"; Try it online! Golfed 30 bytes thanks to @Shaggy's advice. P2 (given I inputted 10): <?=$argv[1]+10; Try it online!
PHP, 32 24 bytes <?=strrev(fgets(STDIN)); Try it online!
Python 3, 53 38 bytes def f(x,y): for c in x:print(end=c*y) Try it online! I'm sure someone will find a lambda solution to this. Golfed 15 bytes thanks to @Moshi's advice.
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...
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...
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,...
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...
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!
Python 3, 196 195 145 102 91 89 87 79 bytes x=input();x+=x[::-1];i=-1 for c in x[:-1]:print(c*(i>-1)+" "*i+c);i+=1 print(x) Try it online! Golfed 50 bytes thanks to @celtschk's advice. ...
Challenge Create a program that takes input of a string and outputs an integer using the following calculation system: The string can only contain +, -, *, /, ^, ! (or a different character; ! ...
Lua, 35 32 bytes print("Hello, "..io.read().."!") Try it online! Golfed 3 bytes thanks to @Moshi's advice.
Python 3, 27 bytes print(f"Hello, {input()}!") Try it online!
Background While we do have a "Hello, World!" challenge, we still don't have one regarding input. So let's do one! Challenge Create a program that takes an input (not as a function argument) the...
Just curious, but this might help other users, so I'm placing at Meta. A popularity-contest is a non-object winning criteria challenge that is based on having the highest scored answer of the chal...
Python 3, 874 bytes a="'Twas brillig, and the slithy toves\nDid gyre and gimble in the wabe;\nAll mimsy were the borogoves,\nAnd the mome raths outgrabe.";b="he Jabberwock";c="Beware t";d="One, ...
C (clang), 63 bytes x,y;main(){scanf("%i%i",&x,&y);printf("%i %i\n%i %i",x,y,y,x);} Try it online!
Create a program that gets all perfect squares starting from 0 or 1 without using any methods of multiplication (repetitive addition) and exponentiation (repetitive multiplication). Output them for...