Re: Show off your Python chops and compete with others

2013-11-12 Thread Nathaniel Sokoll-Ward
Hi Omar,

Thanks for the suggestions!

Your point about question difficulty is well taken. We previously organized
questions into sections based on difficulty or topic, but have been
experimenting with doing away with sections entirely. We are developing a
way to intelligently deliver questions to a user based on their perceived
skill level.

You're right that our checks can be defeated with sneakiness, but in the
end we believe that it makes more sense to implement incentives to
encourage people to post high quality answers, than to build full-proof
validation tools.

Thanks again!


On Thu, Nov 7, 2013 at 11:09 PM, Omar Abou Mrad omar.aboum...@gmail.comwrote:


 On Thu, Nov 7, 2013 at 2:00 AM, Nathaniel Sokoll-Ward 
 nathanielsokollw...@gmail.com wrote:

 Thought this group would appreciate this:
 www.metabright.com/challenges/python

 MetaBright makes skill assessments to measure how talented people are at
 different skills. And recruiters use MetaBright to find outrageously
 skilled job candidates.

 Python is a new area of expertise for us. We make Challenges for a
 bunch of languages and we're excited to finally have Python released. Give
 it a shot -- I'd love to hear what you think.
 --
 https://mail.python.org/mailman/listinfo/python-list


 Nathaniel,

 You may want to classify the questions under some weight. You can't really
 have a level 6 question about semi colon.

 Also, when the boss questions are being computed, you should run more than
 the 'example' given as a test, otherwise users can just cheat. For example,
 I think one of the 'Boss' question was return the first 3 digits of PI as a
 list, all i did was:

 return [3,1,4]

 Hope this helps.


-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Show off your Python chops and compete with others

2013-11-08 Thread Mark Lawrence

On 08/11/2013 02:18, Roy Smith wrote:

In article l5hh32$qf4$1...@dont-email.me, alex23 wuwe...@gmail.com
wrote:


On 8/11/2013 11:54 AM, Roy Smith wrote:

Dead code doesn't count.


Neither do shifting goalposts.


It's not a shifting goalpost.  My original statement was that:

def foo():
raise Exception

defines a function which 1) has no explicit return statement and 2) does
not return None.  I stand by that statement.  There is no possible
codepath, no possible calling sequence, no possible execution
environment, which will cause that function to return None.  That fact
that one particular Python implementation happens to produce unreachable
bytecode for returning None is meaningless.  Would you say that:

def baz():
return None
print I got here

is a function which prints I got here?



Game, set and match to Roy Smith? :)

--
Python is the second best programming language in the world.
But the best has yet to be invented.  Christian Tismer

Mark Lawrence

--
https://mail.python.org/mailman/listinfo/python-list


Re: Show off your Python chops and compete with others

2013-11-07 Thread Nathaniel Sokoll-Ward
Wow! Thanks for all the feedback everyone. This content is fresh so I 
appreciate everyone's comments. As opposed to responding to each post 
individually, I'll just lump everything in here...

Andrew, big thanks for your comments:

 What is the correct number of spaces for indentation in Python? 

 I presume the question should be more along the lines of What does PEP8 
 say?, because all answers are correct. 

I agree. Question has been edited.


 String literals are written with what? 

 The answer is not ALl of these answers are correct 

I believe that string literals can be written with single, double, or triple 
quotes: http://docs.python.org/release/2.5.2/ref/strings.html

 Which is a correct way to perform exponentiation in Python? 

This was a silly error. Thanks for pointing it out.

 What does the following code do? 
 def a(b, c, d): pass 

 My answer: Defines a function which returns None, but that isn't one 
 of the choices. 

Roy, thanks for your note. When I run this code, the function just gets defined 
and nothing happens. None isn't returned. Do you recall why you found the 
options available to you unsuitable?

 How could you open a file c:\scores.dat to write in binary? 

 outfile = open(c:\\scores.dat, w) 
 outfile = open(c:\scores.dat, a) 
 outfile = open(c:\\scores.dat, w) 
 outfile = open(c:\\scores.dat, wb) 

 Not technically wrong, but stylistically suspect; I would recommend 
 using forward slashes (which work fine on Windows) and avoiding the 
 drive letter, both of which avoid making your example 
 Windows-specific. (At least, I don't think there are any other 
 platforms Python supports that use drive letters; OS/2 support was 
 dropped a little while ago, though I believe Paul Smedley still 
 maintains a port. But I digress.) 

Excellent suggestion. We've gone ahead and made the change.


 Which method will write a pickled representation of the object to 
 an open file? 

 Method names without object names aren't all that useful. Do you mean 
 Which method of the pickle module...? 

Again, great suggestion.

 
 From which languages are Python classes derived from? 

 Sounds like Python history trivia more than a coding challenge, but if 
 that's what you want to go for, sure. 

I agree it's not directly coding related. Our questions are actually sorted 
into topic buckets. We try to get a reading on people's knowledge in a bunch of 
different areas of a given skill. Familiarity with general knowledge facts such 
as this, gives us another data point to help parse out the types of questions 
the best developers tend to get right.

 By the way, here's a fairly bad solution to your final question: 

 array666=lambda x:b\6\6\6 in bytes(x) 

 Works for the given test-cases! Doesn't work with arrays at all, 
 despite the description. 

Chris, I actually really like your answer, even if it doesn't satisfy the goal 
in the question. I'd give it a vote for cleverness!

 You know, I didn't even notice that. But since that was copied and 
 pasted, I would say that yes, it really does. That's a pretty simple 
 grammatical bugfix though. 

Silly error. Fixed.

 I have to concur with what several other people are saying here.  Several of 
 MetaBright's questions are  ambiguously worded, or expect non-idiomatic 
 Python code.  It might be helpful for you to ask (hire?)  some seasoned 
 Python programmers to critique your questions. 

Thanks for the thoughts, John. I'd be lying if I said I wasn't disappointed 
with how many errors everyone here is picking out. Some of our Challenges are 
built exclusively by our users, others are built by someone who helped build 
MetaBright, while others, like the Python Challenge, are built with the help of 
contractors. Even so, the responsibility to make sure we are publishing high 
quality content falls on our shoulders and I regret we didn't go a better job 
of vetting this material. 

 With tracking cookies blocked, you get 0 points. 

 And with JavaScript blocked, you get bupkis. :-) 

I know that's frustrating. Our tech lead will be on here later today to explain 
why we do this.

Thanks again everyone!


-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Show off your Python chops and compete with others

2013-11-07 Thread Mark Lawrence

On 07/11/2013 18:38, Nathaniel Sokoll-Ward wrote:


My answer: Defines a function which returns None, but that isn't one
of the choices.


Roy, thanks for your note. When I run this code, the function just gets defined 
and nothing happens. None isn't returned. Do you recall why you found the 
options available to you unsuitable?



 def a(b, c, d): pass
...
 x=a(1,2,3);type(x)
class 'NoneType'

--
Python is the second best programming language in the world.
But the best has yet to be invented.  Christian Tismer

Mark Lawrence

--
https://mail.python.org/mailman/listinfo/python-list


Re: Show off your Python chops and compete with others

2013-11-07 Thread jskirst
We do not currently support cookieless or javascript-less browsing. We are 
definitely looking at relying less and less on cookies, but it's unlikely we'll 
ever be able to pull out javascript as it limits interactivity too much. Its 
definitely possible to do, and maybe something we can look at in the future, 
but right now we don't have the resources for that. Sorry for the inconvenience!

- Jonathan Kirst
Lead Engineer at MetaBright

On Wednesday, November 6, 2013 7:19:23 PM UTC-8, Tim Chase wrote:
 On 2013-11-06 17:31, John Nagle wrote:
 
   MetaBright makes skill assessments to measure how talented
 
   people are at different skills. And recruiters use MetaBright to
 
   find outrageously skilled job candidates.  
 
  
 
  With tracking cookies blocked, you get 0 points.
 
 
 
 And with JavaScript blocked, you get bupkis. :-)
 
 
 
 I was amused that the sidebar of similar challenges suggested that
 
 the Python challenge might be similar to this one.  Ya think?  So
 
 similar that even the URL is the same...
 
 
 
 -tkc
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Show off your Python chops and compete with others

2013-11-07 Thread Alister
On Thu, 07 Nov 2013 10:38:40 -0800, Nathaniel Sokoll-Ward wrote:

 Wow! Thanks for all the feedback everyone. This content is fresh so I
 appreciate everyone's comments. As opposed to responding to each post
 individually, I'll just lump everything in here...
 
 

 My answer: Defines a function which returns None, but that isn't one
 of the choices.
 
 Roy, thanks for your note. When I run this code, the function just gets
 defined and nothing happens. None isn't returned. Do you recall why you
 found the options available to you unsuitable?

your sites answer is  defines a function that does nothing
once you have defined the function try print (a(1,2,3))
you will see that is does indeed return none, as do all functions without 
an explicit return.
 

 Thanks again everyone!
-- 
While you recently had your problems on the run, they've regrouped and
are making another attack.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Show off your Python chops and compete with others

2013-11-07 Thread Tim Chase
On 2013-11-07 11:02, jski...@gmail.com wrote:
 it's unlikely we'll ever be able to pull out javascript as it
 limits interactivity too much.

It was mostly in jest as it's one of the things I test when doing
web development.  That said, the quizzes are mostly just HTML forms
where you pick the answer with a radio button and click the [next]
button.  There's not much interactivity there that hasn't been around
since the dawn of the web.

Additionally, I noticed that if I accidentally select an answer
(laptop track-pads aren't the most precise pointing devices), there
was no readily-apparent way to change/fix it before hitting [next].

-tkc



-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Show off your Python chops and compete with others

2013-11-07 Thread Chris Angelico
On Fri, Nov 8, 2013 at 5:38 AM, Nathaniel Sokoll-Ward
nathanielsokollw...@gmail.com wrote:
 Wow! Thanks for all the feedback everyone. This content is fresh so I 
 appreciate everyone's comments. As opposed to responding to each post 
 individually, I'll just lump everything in here...

Best way, I think :)

 I believe that string literals can be written with single, double, or triple 
 quotes: http://docs.python.org/release/2.5.2/ref/strings.html

Hmm. As a general rule, can you consider aiming your quiz - and any
citations like this - at a current version of Python? I'd prefer to
see this sort of thing aimed at the 3.3 docs, though if you want to
cite 2.7 that would also be of value. But 2.5 is now quite old, and
I'd rather not get the impression that you're writing a quiz based on
an unsupported version of Python. :) Though in this particular
instance it makes no difference.

 By the way, here's a fairly bad solution to your final question:

 array666=lambda x:b\6\6\6 in bytes(x)

 Works for the given test-cases! Doesn't work with arrays at all,
 despite the description.

 Chris, I actually really like your answer, even if it doesn't satisfy the 
 goal in the question. I'd give it a vote for cleverness!

Heh. Do you know what the limitation of my solution is, though? As I
said, it works for the given test-cases; what sort of input will it
fail on? (And also: What's its algorithmic complexity, and what's the
complexity of a better solution?) That's why I said it's a bad
solution :)

The side comment about arrays, though: Python *does* have arrays, but
they're a different beast from what you're working with, which are
called lists. The version I posted will actually work with any
iterable, but specifying that it be a list might open up some other
options.

BTW, you're going to see a lot of criticism on the list, because
that's the natural state of things. Doesn't mean we didn't enjoy
taking the quiz. :)

In your Intermediate section:
Which of the following is false regarding the raw_input() and
input() built-in functions in Python?

The old raw_input() has been renamed to input() in Python 3.x
input() is equivalent to exec(raw_input())
In Python 2.x, raw_input() returns a string.
raw_input() does not exist in Python 3.x

Technically one of those is false, but (a) you really need to specify
versions a LOT more clearly here, and (b) the falseness is a minor
technicality; it took me a while to notice that you'd written exec
where it actually uses eval. Is that distinction really worth
highlighting in the quiz?

Which of the following statements is false?

Python can be used to generate dynamic web pages.
Python can be used for web development.
Python's syntax is much like PHP.
Python can run on any type of platform.

What does *any type* of platform mean? Do you mean any platform, and
if so, do you mean that there is no pocket calculator on which Python
doesn't run? Or is there some other type of platform?

 type(platform)
class 'module'

I get it. Python will run on any module. *dives for cover*

BTW, here's my chosen bad solution for the boss question at the end
of the intermediate section. I'm sure someone here can come up with a
worse one. Wasn't sure what should be done if all three numbers are
the same, incidentally.

def indie_three(*numbers):
seen = {}
tot = 0
for n in numbers:
seen.setdefault(n, 5)
seen[n] -= 4
tot += n * seen[n]
return tot

Note how I've generalized it to any number of input values AND to any
possible number of duplicates!

ChrisA
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Show off your Python chops and compete with others

2013-11-07 Thread 88888 Dihedral
On Friday, November 8, 2013 3:02:10 AM UTC+8, jsk...@gmail.com wrote:
 We do not currently support cookieless or javascript-less browsing. We are 
 definitely looking at relying less and less on cookies, but it's unlikely 
 we'll ever be able to pull out javascript as it limits interactivity too 
 much. Its definitely possible to do, and maybe something we can look at in 
 the future, but right now we don't have the resources for that. Sorry for the 
 inconvenience!
 
 
 
 - Jonathan Kirst
 
 Lead Engineer at MetaBright
 
 
 
 On Wednesday, November 6, 2013 7:19:23 PM UTC-8, Tim Chase wrote:
 
  On 2013-11-06 17:31, John Nagle wrote:
 
  
 
MetaBright makes skill assessments to measure how talented
 
  
 
people are at different skills. And recruiters use MetaBright to
 
  
 
find outrageously skilled job candidates.  
 
  
 
   
 
  
 
   With tracking cookies blocked, you get 0 points.
 
  
 
  
 
  
 
  And with JavaScript blocked, you get bupkis. :-)
 
  
 
  
 
  
 
  I was amused that the sidebar of similar challenges suggested that
 
  
 
  the Python challenge might be similar to this one.  Ya think?  So
 
  
 
  similar that even the URL is the same...
 
  
 
  
 
  
 
  -tkc

That is easy. Please use FireFox 
plus NoScript to achieve what you 
want. 

-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Show off your Python chops and compete with others

2013-11-07 Thread Roy Smith
In article pyReu.25286$ql7.11998@fx33.am4,
 Alister alister.w...@ntlworld.com wrote:

 your sites answer is  defines a function that does nothing
 once you have defined the function try print (a(1,2,3))
 you will see that is does indeed return none, as do all functions without 
 an explicit return.

Well, if you want to be truly pedantic about it (*), this defines a 
function without an explicit return and which does not return None:

def foo():
   raise Exception

and, for that matter:

def bar():
   import os
   os._exit(0)  # Or variations, such as exec()

(*) and I do.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Show off your Python chops and compete with others

2013-11-07 Thread alex23

On 8/11/2013 11:02 AM, Roy Smith wrote:

Well, if you want to be truly pedantic about it (*), this defines a
function without an explicit return and which does not return None:

def foo():
raise Exception



In [2]: import dis
In [3]: dis.dis(foo)
  2   0 LOAD_GLOBAL  0 (Exception)
  3 RAISE_VARARGS1
  6 LOAD_CONST   0 (None)
  9 RETURN_VALUE

Seeing as we're being pedantic, the function *does* return None, it's 
just that the return value is never seen because an exception is raise.

--
https://mail.python.org/mailman/listinfo/python-list


Re: Show off your Python chops and compete with others

2013-11-07 Thread Roy Smith
In article l5hfuj$m2n$1...@dont-email.me, alex23 wuwe...@gmail.com 
wrote:

 On 8/11/2013 11:02 AM, Roy Smith wrote:
  Well, if you want to be truly pedantic about it (*), this defines a
  function without an explicit return and which does not return None:
 
  def foo():
  raise Exception
 
 
 In [2]: import dis
 In [3]: dis.dis(foo)
2   0 LOAD_GLOBAL  0 (Exception)
3 RAISE_VARARGS1
6 LOAD_CONST   0 (None)
9 RETURN_VALUE
 
 Seeing as we're being pedantic, the function *does* return None, it's 
 just that the return value is never seen because an exception is raise.

Dead code doesn't count.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Show off your Python chops and compete with others

2013-11-07 Thread alex23

On 8/11/2013 11:54 AM, Roy Smith wrote:

Dead code doesn't count.


Neither do shifting goalposts.

--
https://mail.python.org/mailman/listinfo/python-list


Re: Show off your Python chops and compete with others

2013-11-07 Thread Roy Smith
In article l5hh32$qf4$1...@dont-email.me, alex23 wuwe...@gmail.com 
wrote:

 On 8/11/2013 11:54 AM, Roy Smith wrote:
  Dead code doesn't count.
 
 Neither do shifting goalposts.

It's not a shifting goalpost.  My original statement was that:

def foo():
   raise Exception

defines a function which 1) has no explicit return statement and 2) does 
not return None.  I stand by that statement.  There is no possible 
codepath, no possible calling sequence, no possible execution 
environment, which will cause that function to return None.  That fact 
that one particular Python implementation happens to produce unreachable 
bytecode for returning None is meaningless.  Would you say that:

def baz():
   return None
   print I got here

is a function which prints I got here?
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Show off your Python chops and compete with others

2013-11-07 Thread Chris Angelico
On Fri, Nov 8, 2013 at 1:18 PM, Roy Smith r...@panix.com wrote:
 It's not a shifting goalpost.  My original statement was that:

 def foo():
raise Exception

 defines a function which 1) has no explicit return statement and 2) does
 not return None.  I stand by that statement.  There is no possible
 codepath, no possible calling sequence, no possible execution
 environment, which will cause that function to return None.  That fact
 that one particular Python implementation happens to produce unreachable
 bytecode for returning None is meaningless.  Would you say that:

 def baz():
return None
print I got here

 is a function which prints I got here?

Granted, but I would describe this:

def foo(x):
return Hello, world!\n + str(x)

as a function which returns a string. Is it? Well, not if str raises
an exception. Even if the only arguments you can give to foo will
result in exceptions, I would still say that, per design, this is a
function that returns a string. The possibility of raising an
exception (and thus not returning anything) doesn't change a
function's return type (by which I mean more than just what C would
use as the declaration - I could just as well say Returns the name of
an employee, and the same argument would apply).

ChrisA
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Show off your Python chops and compete with others

2013-11-07 Thread Tim Chase
On 2013-11-07 21:18, Roy Smith wrote:
 It's not a shifting goalpost.  My original statement was that:
 
 def foo():
raise Exception
 
 defines a function which 1) has no explicit return statement and 2)
 does not return None.  I stand by that statement.  There is no
 possible codepath, no possible calling sequence, no possible
 execution environment, which will cause that function to return
 None.

Well, for varying definitions of that function, you can do

 def unerr(fn):
... def wrapper(*args, **kwargs):
... try:
... fn(*args, **kwargs)
... except:
... return None
... return wrapper
... 
 @unerr
... def foo():
... raise Exception
... 
 print foo()
None

;-)

Beyond that, I'm sure one could resort to bytecode hacking to have
that function skip the raise...

-tkc



-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Show off your Python chops and compete with others

2013-11-07 Thread Steven D'Aprano
On Thu, 07 Nov 2013 22:05:14 -0600, Tim Chase wrote:

 On 2013-11-07 21:18, Roy Smith wrote:
 It's not a shifting goalpost.  My original statement was that:
 
 def foo():
raise Exception
 
 defines a function which 1) has no explicit return statement and 2)
 does not return None.  I stand by that statement.  There is no possible
 codepath, no possible calling sequence, no possible execution
 environment, which will cause that function to return None.
 
 Well, for varying definitions of that function, you can do
[snip modified functions]
 Beyond that, I'm sure one could resort to bytecode hacking to have that
 function skip the raise...

Now who's shifting the goalposts? Whether you edit the function's source 
code, wrap it in a decorator, or hack it's byte-code, it's not the same 
function as the one Roy showed above by any reasonable definition of the 
same. As an intellectual exercise of how one might subvert the standard 
semantics of the Python compiler, it is interesting to consider (say) 
byte-code hacks that turn this source code:

def foo():
raise Exception

into something that returns None, but by the same logic one might say 
that this function:

def spam():
return 42

connects to some database over the Internet and deletes any table 
containing more than seven records. If we're going to allow those sorts 
of debating shenanigans, the obvious counter is yes, but when I said 
that the function doesn't return None, I actually meant that it doesn't 
solve the Halting Problem, and it still doesn't do that, so I win nyah 
nyah nyah.



-- 
Steven
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Show off your Python chops and compete with others

2013-11-07 Thread Gregory Ewing

alex23 wrote:

In [2]: import dis
In [3]: dis.dis(foo)
  2   0 LOAD_GLOBAL  0 (Exception)
  3 RAISE_VARARGS1
  6 LOAD_CONST   0 (None)
  9 RETURN_VALUE

Seeing as we're being pedantic, the function *does* return None, it's 
just that the return value is never seen because an exception is raise.


Koan for the day:

If a man goes into the forest and never returns,
does he bring back nothing?

--
Greg
--
https://mail.python.org/mailman/listinfo/python-list


Re: Show off your Python chops and compete with others

2013-11-07 Thread Omar Abou Mrad
On Thu, Nov 7, 2013 at 2:00 AM, Nathaniel Sokoll-Ward 
nathanielsokollw...@gmail.com wrote:

 Thought this group would appreciate this:
 www.metabright.com/challenges/python

 MetaBright makes skill assessments to measure how talented people are at
 different skills. And recruiters use MetaBright to find outrageously
 skilled job candidates.

 Python is a new area of expertise for us. We make Challenges for a bunch
 of languages and we're excited to finally have Python released. Give it a
 shot -- I'd love to hear what you think.
 --
 https://mail.python.org/mailman/listinfo/python-list


Nathaniel,

You may want to classify the questions under some weight. You can't really
have a level 6 question about semi colon.

Also, when the boss questions are being computed, you should run more than
the 'example' given as a test, otherwise users can just cheat. For example,
I think one of the 'Boss' question was return the first 3 digits of PI as a
list, all i did was:

return [3,1,4]

Hope this helps.
-- 
https://mail.python.org/mailman/listinfo/python-list


Show off your Python chops and compete with others

2013-11-06 Thread Nathaniel Sokoll-Ward
Thought this group would appreciate this: www.metabright.com/challenges/python

MetaBright makes skill assessments to measure how talented people are at 
different skills. And recruiters use MetaBright to find outrageously skilled 
job candidates.

Python is a new area of expertise for us. We make Challenges for a bunch of 
languages and we're excited to finally have Python released. Give it a shot -- 
I'd love to hear what you think.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Show off your Python chops and compete with others

2013-11-06 Thread Andrew Cooper
On 07/11/2013 00:00, Nathaniel Sokoll-Ward wrote:
 Thought this group would appreciate this: www.metabright.com/challenges/python
 
 MetaBright makes skill assessments to measure how talented people are at 
 different skills. And recruiters use MetaBright to find outrageously skilled 
 job candidates.
 
 Python is a new area of expertise for us. We make Challenges for a bunch of 
 languages and we're excited to finally have Python released. Give it a shot 
 -- I'd love to hear what you think.
 

What is the correct number of spaces for indentation in Python?

I presume the question should be more along the lines of What does PEP8
say?, because all answers are correct.

String literals are written with what?

The answer is not ALl of these answers are correct


So two of of 7 questions with wrong answers so far...

~Andrew
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Show off your Python chops and compete with others

2013-11-06 Thread Roy Smith
In article jWAeu.102858$rN3.45213@fx21.am4,
 Andrew Cooper root@127.0.0.1 wrote:

 On 07/11/2013 00:00, Nathaniel Sokoll-Ward wrote:
  Thought this group would appreciate this: 
  www.metabright.com/challenges/python
  
  MetaBright makes skill assessments to measure how talented people are at 
  different skills. And recruiters use MetaBright to find outrageously 
  skilled job candidates.
  
  Python is a new area of expertise for us. We make Challenges for a bunch 
  of languages and we're excited to finally have Python released. Give it a 
  shot -- I'd love to hear what you think.
  
 
 What is the correct number of spaces for indentation in Python?




What does the following code do?
def a(b, c, d): pass

My answer: Defines a function which returns None, but that isn't one 
of the choices.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Show off your Python chops and compete with others

2013-11-06 Thread Andrew Cooper
On 07/11/2013 00:24, Roy Smith wrote:
 In article jWAeu.102858$rN3.45213@fx21.am4,
  Andrew Cooper root@127.0.0.1 wrote:
 
 On 07/11/2013 00:00, Nathaniel Sokoll-Ward wrote:
 Thought this group would appreciate this: 
 www.metabright.com/challenges/python

 MetaBright makes skill assessments to measure how talented people are at 
 different skills. And recruiters use MetaBright to find outrageously 
 skilled job candidates.

 Python is a new area of expertise for us. We make Challenges for a bunch 
 of languages and we're excited to finally have Python released. Give it a 
 shot -- I'd love to hear what you think.


 What is the correct number of spaces for indentation in Python?
 
 
 
 
 What does the following code do?
 def a(b, c, d): pass
 
 My answer: Defines a function which returns None, but that isn't one 
 of the choices.
 

Which is a correct way to perform exponentiation in Python?

1) math.pow(a,b)
2) a^b
3) a*2b
4) None of the other responses are correct

Apparently I was wrong by answering 4), and 1) is the expected answer.
Clearly the author doesn't know about the ** operator in python.


It appears that no serious python coders were consulted when writing
these questions.

~Andrew
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Show off your Python chops and compete with others

2013-11-06 Thread Mark Lawrence

On 07/11/2013 00:28, Andrew Cooper wrote:

On 07/11/2013 00:24, Roy Smith wrote:

In article jWAeu.102858$rN3.45213@fx21.am4,
  Andrew Cooper root@127.0.0.1 wrote:


On 07/11/2013 00:00, Nathaniel Sokoll-Ward wrote:

Thought this group would appreciate this:
www.metabright.com/challenges/python

MetaBright makes skill assessments to measure how talented people are at
different skills. And recruiters use MetaBright to find outrageously
skilled job candidates.

Python is a new area of expertise for us. We make Challenges for a bunch
of languages and we're excited to finally have Python released. Give it a
shot -- I'd love to hear what you think.



What is the correct number of spaces for indentation in Python?





What does the following code do?
def a(b, c, d): pass

My answer: Defines a function which returns None, but that isn't one
of the choices.



Which is a correct way to perform exponentiation in Python?

1) math.pow(a,b)
2) a^b
3) a*2b
4) None of the other responses are correct

Apparently I was wrong by answering 4), and 1) is the expected answer.
Clearly the author doesn't know about the ** operator in python.


It appears that no serious python coders were consulted when writing
these questions.

~Andrew



So that narrows the search for the culprit down to our Greek aquaintance? :)

--
Python is the second best programming language in the world.
But the best has yet to be invented.  Christian Tismer

Mark Lawrence

--
https://mail.python.org/mailman/listinfo/python-list


Re: Show off your Python chops and compete with others

2013-11-06 Thread Chris Angelico
On Thu, Nov 7, 2013 at 11:00 AM, Nathaniel Sokoll-Ward
nathanielsokollw...@gmail.com wrote:
 Thought this group would appreciate this: www.metabright.com/challenges/python

 MetaBright makes skill assessments to measure how talented people are at 
 different skills. And recruiters use MetaBright to find outrageously skilled 
 job candidates.

 Python is a new area of expertise for us. We make Challenges for a bunch of 
 languages and we're excited to finally have Python released. Give it a shot 
 -- I'd love to hear what you think.

How could you open a file c:\scores.dat to write in binary?

outfile = open(c:\\scores.dat, w)
outfile = open(c:\scores.dat, a)
outfile = open(c:\\scores.dat, w)
outfile = open(c:\\scores.dat, wb)

Not technically wrong, but stylistically suspect; I would recommend
using forward slashes (which work fine on Windows) and avoiding the
drive letter, both of which avoid making your example
Windows-specific. (At least, I don't think there are any other
platforms Python supports that use drive letters; OS/2 support was
dropped a little while ago, though I believe Paul Smedley still
maintains a port. But I digress.)

Which method will write a pickled representation of the object to
an open file?

Method names without object names aren't all that useful. Do you mean
Which method of the pickle module...?

From which languages are Python classes derived from?

Sounds like Python history trivia more than a coding challenge, but if
that's what you want to go for, sure.

ChrisA
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Show off your Python chops and compete with others

2013-11-06 Thread Chris Angelico
On Thu, Nov 7, 2013 at 11:00 AM, Nathaniel Sokoll-Ward
nathanielsokollw...@gmail.com wrote:
 Thought this group would appreciate this: www.metabright.com/challenges/python

 MetaBright makes skill assessments to measure how talented people are at 
 different skills. And recruiters use MetaBright to find outrageously skilled 
 job candidates.

 Python is a new area of expertise for us. We make Challenges for a bunch of 
 languages and we're excited to finally have Python released. Give it a shot 
 -- I'd love to hear what you think.

By the way, here's a fairly bad solution to your final question:

array666=lambda x:b\6\6\6 in bytes(x)

Works for the given test-cases! Doesn't work with arrays at all,
despite the description.

ChrisA
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Show off your Python chops and compete with others

2013-11-06 Thread MRAB

On 07/11/2013 00:59, Chris Angelico wrote:

On Thu, Nov 7, 2013 at 11:00 AM, Nathaniel Sokoll-Ward
nathanielsokollw...@gmail.com wrote:

Thought this group would appreciate this: www.metabright.com/challenges/python

MetaBright makes skill assessments to measure how talented people are at 
different skills. And recruiters use MetaBright to find outrageously skilled 
job candidates.

Python is a new area of expertise for us. We make Challenges for a bunch of 
languages and we're excited to finally have Python released. Give it a shot -- I'd love 
to hear what you think.


How could you open a file c:\scores.dat to write in binary?

outfile = open(c:\\scores.dat, w)
outfile = open(c:\scores.dat, a)
outfile = open(c:\\scores.dat, w)
outfile = open(c:\\scores.dat, wb)

Not technically wrong, but stylistically suspect; I would recommend
using forward slashes (which work fine on Windows) and avoiding the
drive letter, both of which avoid making your example
Windows-specific. (At least, I don't think there are any other
platforms Python supports that use drive letters; OS/2 support was
dropped a little while ago, though I believe Paul Smedley still
maintains a port. But I digress.)

Which method will write a pickled representation of the object to
an open file?

Method names without object names aren't all that useful. Do you mean
Which method of the pickle module...?

From which languages are Python classes derived from?


Does it really have the word from twice?


Sounds like Python history trivia more than a coding challenge, but if
that's what you want to go for, sure.



--
https://mail.python.org/mailman/listinfo/python-list


Re: Show off your Python chops and compete with others

2013-11-06 Thread Chris Angelico
On Thu, Nov 7, 2013 at 12:12 PM, MRAB pyt...@mrabarnett.plus.com wrote:
 From which languages are Python classes derived from?

 Does it really have the word from twice?

You know, I didn't even notice that. But since that was copied and
pasted, I would say that yes, it really does. That's a pretty simple
grammatical bugfix though.

ChrisA
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Show off your Python chops and compete with others

2013-11-06 Thread John Nagle
On 11/6/2013 5:04 PM, Chris Angelico wrote:
 On Thu, Nov 7, 2013 at 11:00 AM, Nathaniel Sokoll-Ward
 nathanielsokollw...@gmail.com wrote:
 Thought this group would appreciate this: 
 www.metabright.com/challenges/python

 MetaBright makes skill assessments to measure how talented people are at 
 different skills. And recruiters use MetaBright to find outrageously skilled 
 job candidates.

   With tracking cookies blocked, you get 0 points.

John Nagle
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Show off your Python chops and compete with others

2013-11-06 Thread John Ladasky
On Wednesday, November 6, 2013 4:00:57 PM UTC-8, Nathaniel Sokoll-Ward wrote:
 Thought this group would appreciate this: www.metabright.com/challenges/python

I have to concur with what several other people are saying here.  Several of 
MetaBright's questions are ambiguously worded, or expect non-idiomatic Python 
code.  It might be helpful for you to ask (hire?) some seasoned Python 
programmers to critique your questions.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Show off your Python chops and compete with others

2013-11-06 Thread Chris Angelico
On Thu, Nov 7, 2013 at 12:55 PM, John Ladasky
john_lada...@sbcglobal.net wrote:
 On Wednesday, November 6, 2013 4:00:57 PM UTC-8, Nathaniel Sokoll-Ward wrote:
 Thought this group would appreciate this: 
 www.metabright.com/challenges/python

 I have to concur with what several other people are saying here.  Several of 
 MetaBright's questions are ambiguously worded, or expect non-idiomatic Python 
 code.  It might be helpful for you to ask (hire?) some seasoned Python 
 programmers to critique your questions.

No need to hire anyone, just posting the questions here will generate
exactly such a critique - as evidenced by this thread :)

ChrisA
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Show off your Python chops and compete with others

2013-11-06 Thread Tim Chase
On 2013-11-06 17:31, John Nagle wrote:
  MetaBright makes skill assessments to measure how talented
  people are at different skills. And recruiters use MetaBright to
  find outrageously skilled job candidates.  
 
 With tracking cookies blocked, you get 0 points.

And with JavaScript blocked, you get bupkis. :-)

I was amused that the sidebar of similar challenges suggested that
the Python challenge might be similar to this one.  Ya think?  So
similar that even the URL is the same...

-tkc



-- 
https://mail.python.org/mailman/listinfo/python-list