programming challenge

Discuss how to write good code, break bad code, your current pet projects, or the best way to approach novel problems

Re: programming challenge

Post by pretentious on Tue Nov 05, 2013 2:07 am
([msg=78047]see Re: programming challenge[/msg])

hellow533 wrote:Bitch please, if you don't check to make sure something works before giving it as a test to others, you're just hurting yourself. Working or not, you should check. I do program sometimes, and I can't imagine submitting a database management system update to my boss without first checking to make sure it works.

Fair enough bro but this was ten lines of python, not a database management system and you are not my boss 8-) but don't worry, I'll be slightly more careful in the future ;)
Goatboy wrote:Oh, that's simple. All you need to do is dedicate many years of your life to studying security.

IF you feel like exchanging ASCII arrays, let me know ;)
pretentious wrote:Welcome to bat country
User avatar
pretentious
Contributor
Contributor
 
Posts: 624
Joined: Wed Mar 03, 2010 12:48 am
Blog: View Blog (0)


Re: programming challenge

Post by -Ninjex- on Fri Nov 08, 2013 2:03 pm
([msg=78094]see Re: programming challenge[/msg])

It was something funnish I suppose; thanks to Project Euler for making think of good one liners lately. Substitute s for the string
Code is in Ruby 1.9.3p0
Code: Select all
#!/usr/bin/ruby
puts s.split(/[^0-9]/).map(&:to_i).inject(:+)

Output: 128434
If you're not willing to learn, no one can help you. If you're determined to learn, no one can stop you.⠠⠵
The absence of evidence is not evidence of absence.
I can explain it for you, but I can't understand it for you.
User avatar
-Ninjex-
Addict
Addict
 
Posts: 1236
Joined: Sun Sep 02, 2012 8:02 pm
Blog: View Blog (0)


Previous

Return to Programming

Who is online

Users browsing this forum: No registered users and 0 guests