Search Results
Search type | Search syntax |
---|---|
Tags | [tag] |
Exact | "words here" |
Author |
user:1234 user:me (yours) |
Score |
score:3 (3+) score:0 (none) |
Answers |
answers:3 (3+) answers:0 (none) isaccepted:yes hasaccepted:no inquestion:1234 |
Views | views:250 |
Code | code:"if (foo != bar)" |
Sections |
title:apples body:"apples oranges" |
URL | url:"*.example.com" |
Saves | in:saves |
Status |
closed:yes duplicate:no migrated:no wiki:no |
Types |
is:question is:answer |
Exclude |
-[tag] -apples |
For more details on advanced search visit our help page |
Code-golf is a competition to solve a particular problem in the fewest bytes of source code.
0
votes
Find the temperature closest to 0
Python, 62 bytes
def f(n):
r=min(map(abs,n))
return r if r in n else -r
It feels like there is a much simpler/shorter solution.
2
votes
Tell my friends to which "comma club" they belong
Python 2, 69 bytes
Setup our arrays:
n = ['John', 'Jamie', 'Kylie', 'Laura', 'Russ', 'Karla', 'Reid', 'Mark', 'Manson', 'Lonnie']
a = [100000, 0.05, 1549001.10, 999999999.99, 1000000000, 1, 99.99, 9 …
0
votes
One more LUL and I'm out
Python, 78 bytes
f=lambda n:'One more "'*(n-1)+"One more LUL and I'm out"+'" and I\'m out'*(n-1)
2
votes
Notcalc (Calculate the wrong answer)
Python, 25 17 bytes
Takes an array of numbers n, and returns their sum + 1:
lambda n:sum(n,1)
I just translated https://codegolf.stackexchange.com/a/111845/66068 into python.
-1
votes
Hack into a Lottery
Python, 20 (or 26) bytes
(5-3)**ord('@')-3**0
ord('@') is equal to 64.
The full function/programme (@BusinessCat, I hope this is more in line with what is expected) would add 6 bytes:
print (5-3 …
7
votes
Pick a random number between 0 and n using a constant source of randomness
Python, 61 bytes
from random import*
lambda n,x=2.**30:int(randrange(x)*-~n/x)
Edit:
Updated to avoid forbidden form
Edit2:
Saved 2 bytes, thanks @JonathanAllan
Edit3:
Paid 2 bytes for a fully fu …
1
vote
I'm too cold, turn up the temperature
Python 2, 57 bytes
import time as t
x=40
while x<73:print x;t.sleep(.5);x+=2
This does require an 'extra' newline to actually run, so arguably response is 58 bytes (please feel free to edit/comment …