5 ms·
Funny bit about this is that someone will give these people millions in funding or acquihire. All for a: from random import randint choice = randint(1
by orangethirty 13y ago
Funny bit about this is that someone will give these people millions in funding or acquihire. All for a:
from random import randint
choice = randint(1, 6)
delete = randint(1, 6)
if choice == delete:
print "Today is not your lucky day."
else:
print "Try again tomorrow."
print "Today's choice was {0}.".format(choice)
#I felt like writing some bad python.
- m4design 13y agoThere's a bug in your code, the chance of deleting is less than 1/6.
- olympus 13y agoWhile the code could use streamlining by only drawing one randint and comparing it to a static number, the probability of orangethirty's way of doing it still gives the correct probability of 1/6. Think of it as two dice, the chance of rolling doubles is 6/36 = 1/6.
- andrewchoi 13y agoI think the point of the post you're responding to is that the code doesn't actually delete anything.
- orangethirty 13y agoHow could it delete what is not there? Or did you really expect me to write python script with fb graph integration?
- SandB0x 13y agoFYI "choice" is the name of a function in the random module: from random import choice if choice(range(6)): print "Try again tomorrow." else: print "Today is not your lucky day."
- orangethirty 13y agoNo one liner? Im disappointed. Did you read the commnt at the end?
- hawkharris 13y agoI know what you mean. In a sense the backend code is probably pretty simple. But that just goes to show how important the implementation / design really is. I just survived the game, and I thought the spinning revolver wheel is what made the experience.
- orangethirty 13y agoMy point is that the code really doesnt matter in many "startups". Just the fact that someone will buy.
- hawkharris 13y agoAs a programmer I think that well-written code can be beautiful. A pithy, innovative Python script should be worth more than, say, a script that powers a run-of-the-mill to-do list app. At the same time, I think it's understandable that users and investors don't evaluate startups the way I do, using a programmer's mindset. They're more interested in how well the overall idea has been executed from design, marketing and user experience standpoints.