

Put your programming skills to the test - tux1968
http://coderbyte.com/

======
jakubw
The Python version seems to be using an interpreter that frankly just doesn't
work:

    
    
        x = [1, 5, 3, 2, 6, 4]
        x.sort()
        print x
    
        Output: [1, 3, 2, 4, 5, 6]
    

Not to mention the incomplete standard library. I'm not sure what is the
interpreter they're using but it's actually not that hard to sandbox the
CPython one and disable certain functions/modules if necessary.

~~~
kingkilr

        def pyChallenge():
          print sum(s for s in range(1000) if s % 7 != 0 and s % 5 != 0)
    
        pyChallenge()
    

Produces a TypeError, and using xrange produces a NameError (Python 3?). I
have no idea what they're trying, but it doesn't work.

~~~
alexis-d
I assume it's Python 2 (print is a keyword, not a function).

~~~
kingkilr
Ah of course, a SyntaxError would take precedence over their broken builtins.

------
qbproger
It takes a long time to get from challenge to challenge. It'd be better if
from my profile maybe it opened a new window and I could just go down the list
doing them all. As it is now it goes to a page explaining the times and then
asks me if I'm sure I'm ready after that.

It's a cool concept.

I also found that I like sites that don't focus on rankings so much. It's
better if to achieve a level you get a certain number of points. When you have
rankings, if a new person joins your site it looks like a daunting task to get
to the top.

Also, I would include forums for discussing solutions after you've solved it
or attempted a problem a certain number of times. Maybe let people see the
solution forum and 'solve' the problem, but they only get 1 point for that. It
can be frustrating to be stuck on a hard problem for someone trying to learn.
Maybe it'd be cool if you let people ask questions about problems and other
users could get points for answering questions, while making sure not to give
away too much.

Some functions are missing from Python, and being able to use the standard lib
would be nice.

------
xiaoma
I'm not a js guy at all... can anyone explain why this doesn't work for the
guest challenge? I googled a bit and it seems like it should have.

    
    
      function guestChallenge() { 
        // code goes here
        var num = 0;
        for (var i = 1; i< 1001; i++) {
            if (i.toSring(10).match(/7/));
            else num+=i;
        }
        return num;          
      }
    

Edit: I really should have added more context! The challenge was:

 _Using the JavaScript language, have the function guestChallenge() add up all
of the numbers from 1 to 1000. But everytime a number that contains a 7 is
reached, don't add that number to the others (ie. exclude 7, 17, 370, etc). Do
not put any code outside of the function and use the return keyword to return
your answer from within the function._

And my program didn't generate any output at all, which leads me to believe I
made a syntax error as opposed to just a logic error.

Edit again: Yes. I just had to fix my typing error ("toSring"), and then it
passed. Thanks, guys!

~~~
Danieru
I think you missed a 't': i.toSring(10)

~~~
xiaoma
Thank you... I can't believe I wasn't seeing that!

I'm surely not the only one to do this sort of thing. Maybe there should be
some kind of feedback instead of nothing happening when I click the run
button.

------
cr4zy
Here's a fun way to solve

Using the Python language, have the function pyChallenge() add up all of the
numbers from 1 to 1000. But every time a number appears that is divisible by 5
or 7, disregard it and do not add that number to the others (ie. disregard 7,
10, 15, 21, etc). Do not put any code outside of the function and use the
print keyword to return your answer from within the function.

    
    
        def pyChallenge():
            sum = (1000 * (1000 + 1)) / 2
            for i in range(5, 1001, 5):
                sum -= i
            for i in range(7, 1001, 7):
                sum -= i
            for i in range(35, 1001, 35):
                sum += i
        
            print sum
        
            #As opposed to:
            #sum = 0
            #for i in range(1, 1000):
            #    if i % 5 and i % 7:
            #        sum += i
            #print sum
        
        # this call is needed to test your function
        pyChallenge()

~~~
mykhamill
Any particular reason you didn't go for the list comprehension?

    
    
      def pyChallenge():
        print sum([el for el in range(1001) if not((el%5==0) or el%7==0))])
      # this call is needed to test your function
      pyChallenge()

------
c4m
Really fun, but it seems like it provides JS input even if you use python.
This causes all of the input cases to be marked as incorrect. For the Arith
Geo question, here was my code: <https://gist.github.com/1809940> and here was
the result: <https://gist.github.com/1809944> . So for example it said 'new
Array(1,2,3,4)' yielded incorrect output. But I tried running [1,2,3,4] and it
worked fine.

I know I selected python because it let me test my code by running it both
before and after I submitted.

Anyway it's still really fun - keep up the good work!

------
laacz
Idea is good, and have crossed my mind a few times. Design is OK - clean and
simple.

Yet, UI is ridiculous. Logging in utilises pattern, I've never seen before
(just displaying the same login form with a tiny "Thanks for logging in"
message below).

If you use javascript so thoroughly, try to implement HTML5 History API (stay
clear of hashbangs, please). A few times I clicked "back" and went back 5
steps.

Some of backend glitches, probably, can be ignored because of "unexpected"
load, right? :)

Having said all that, it's good that after Bespin and all-favorite
CodeAcademy, programming challange sites get modern touch.

------
ryanhuffman
Very cool.

One thing I would recommend is making sure the problem descriptions are
extremely clear, clarifying bounds, etc. For instance, "Using the JavaScript
language, have the function jsChallenge() add up all of the numbers from 1 to
1000." This should probably read "... numbers from 0 to 1000 exclusive" or
something similar. Looking at problems from programming competitions such as
ACM ICPC would provide really great reference material, at least in terms of
how to describe a problem.

------
capkutay
Awesome website! Just one thing. Before signing up I tried one of the
javascript exercises, when I submitted it I was taken to another page
describing the benefits of being a member. After signing up, I noticed that I
lost my working solution to the first exercise I tried. It would be nice if
you guys found a way to save first-time users code. Looking forward to using
the site!

------
ackdesha
I like the idea, but what version of Python is supported? It seems that some
operations are not supported. On the first challenge it didn't like the
`sorted` built-in or allow iteration over a str object. I ended up solving the
challenge, but in a way that I would never use in real application, i.e., not
idiomatic Python. It should be clearer what language features are allowed.

~~~
abhaga
It didn't like the xrange function. Also doesn't seem to like the generator
expressions.

~~~
bytesong
It doesn't seem to like the map function either. List comprehensions, which
seem to work, could be used instead but it would be nice to know which
features are disabled/not supported before starting to code.

------
randomdata
Fun idea, but by the time I made it to the third challenge, I could no longer
submit my solution. I was stuck on the please wait screen. I suspect this is
due to the load imposed by being featured on HN right now, but in the interest
of scorekeeping, it's not clear how to revert the challenge to regain the lost
time points.

------
jamesu
One thing i dislike about these sites is they mainly seem to deal with
algorithmic problems - the sort you'd find in a typical programming textbook -
rather than any genuinely interesting or fun challenge.

------
edw519
Nice.

For super quick learning, it sure would be nice to see how others solved the
same challenge. Just a few suggestions for links in the "Your code was
correct, great job!" box:

    
    
      - last 5 correct solutions
      - most common solution
      - solution in least lines of code
      - solution in least bytes of code
      - solution presented by <person requested>
    

and if you really wanted to get clever:

    
    
      - most unique (by some definition) correct solution 
      - most elegant (by some definition) correct solution
      - you should use <this> instead of <that> and <why>

------
cr4zy
This is awesome. One point would be to change the spec of Panlindrome to say
print 'false' when it's not a palindrome. (It just says print 'true' when it
is :))

------
js2
This is also a very fun diversion - <http://www.pythonchallenge.com/>

------
adrianp
Are there any issues with certain passwords (too long, containing special
characters)? Also, where is the forgot password link?

------
SaltwaterC
It looks like it doesn't like recursion.

