Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #58601 > unrolled thread
| Started by | Nathaniel Sokoll-Ward <nathanielsokollward@gmail.com> |
|---|---|
| First post | 2013-11-06 16:00 -0800 |
| Last post | 2013-11-12 09:20 -0800 |
| Articles | 12 on this page of 32 — 16 participants |
Back to article view | Back to comp.lang.python
Show off your Python chops and compete with others Nathaniel Sokoll-Ward <nathanielsokollward@gmail.com> - 2013-11-06 16:00 -0800
Re: Show off your Python chops and compete with others Andrew Cooper <root@127.0.0.1> - 2013-11-07 00:13 +0000
Re: Show off your Python chops and compete with others Roy Smith <roy@panix.com> - 2013-11-06 19:24 -0500
Re: Show off your Python chops and compete with others Andrew Cooper <root@127.0.0.1> - 2013-11-07 00:28 +0000
Re: Show off your Python chops and compete with others Mark Lawrence <breamoreboy@yahoo.co.uk> - 2013-11-07 00:38 +0000
Re: Show off your Python chops and compete with others Chris Angelico <rosuav@gmail.com> - 2013-11-07 11:59 +1100
Re: Show off your Python chops and compete with others Chris Angelico <rosuav@gmail.com> - 2013-11-07 12:04 +1100
Re: Show off your Python chops and compete with others John Nagle <nagle@animats.com> - 2013-11-06 17:31 -0800
Re: Show off your Python chops and compete with others Tim Chase <python.list@tim.thechases.com> - 2013-11-06 21:19 -0600
Re: Show off your Python chops and compete with others Nathaniel Sokoll-Ward <nathanielsokollward@gmail.com> - 2013-11-07 10:38 -0800
Re: Show off your Python chops and compete with others Mark Lawrence <breamoreboy@yahoo.co.uk> - 2013-11-07 18:48 +0000
Re: Show off your Python chops and compete with others Alister <alister.ware@ntlworld.com> - 2013-11-07 19:08 +0000
Re: Show off your Python chops and compete with others Roy Smith <roy@panix.com> - 2013-11-07 20:02 -0500
Re: Show off your Python chops and compete with others alex23 <wuwei23@gmail.com> - 2013-11-08 11:49 +1000
Re: Show off your Python chops and compete with others Roy Smith <roy@panix.com> - 2013-11-07 20:54 -0500
Re: Show off your Python chops and compete with others alex23 <wuwei23@gmail.com> - 2013-11-08 12:08 +1000
Re: Show off your Python chops and compete with others Roy Smith <roy@panix.com> - 2013-11-07 21:18 -0500
Re: Show off your Python chops and compete with others Chris Angelico <rosuav@gmail.com> - 2013-11-08 13:26 +1100
Re: Show off your Python chops and compete with others Tim Chase <python.list@tim.thechases.com> - 2013-11-07 22:05 -0600
Re: Show off your Python chops and compete with others Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-11-08 05:26 +0000
Re: Show off your Python chops and compete with others Mark Lawrence <breamoreboy@yahoo.co.uk> - 2013-11-08 09:23 +0000
Re: Show off your Python chops and compete with others Gregory Ewing <greg.ewing@canterbury.ac.nz> - 2013-11-08 19:47 +1300
Re: Show off your Python chops and compete with others Chris Angelico <rosuav@gmail.com> - 2013-11-08 09:55 +1100
Re: Show off your Python chops and compete with others jskirst@gmail.com - 2013-11-07 11:02 -0800
Re: Show off your Python chops and compete with others Tim Chase <python.list@tim.thechases.com> - 2013-11-07 13:30 -0600
Re: Show off your Python chops and compete with others 88888 Dihedral <dihedral88888@gmail.com> - 2013-11-07 16:19 -0800
Re: Show off your Python chops and compete with others MRAB <python@mrabarnett.plus.com> - 2013-11-07 01:12 +0000
Re: Show off your Python chops and compete with others Chris Angelico <rosuav@gmail.com> - 2013-11-07 12:17 +1100
Re: Show off your Python chops and compete with others John Ladasky <john_ladasky@sbcglobal.net> - 2013-11-06 17:55 -0800
Re: Show off your Python chops and compete with others Chris Angelico <rosuav@gmail.com> - 2013-11-07 13:07 +1100
Re: Show off your Python chops and compete with others Omar Abou Mrad <omar.aboumrad@gmail.com> - 2013-11-08 09:09 +0200
Re: Show off your Python chops and compete with others Nathaniel Sokoll-Ward <nathanielsokollward@gmail.com> - 2013-11-12 09:20 -0800
Page 2 of 2 — ← Prev page 1 [2]
| From | Mark Lawrence <breamoreboy@yahoo.co.uk> |
|---|---|
| Date | 2013-11-08 09:23 +0000 |
| Message-ID | <mailman.2198.1383902711.18130.python-list@python.org> |
| In reply to | #58731 |
On 08/11/2013 02:18, Roy Smith wrote: > In article <l5hh32$qf4$1@dont-email.me>, alex23 <wuwei23@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
[toc] | [prev] | [next] | [standalone]
| From | Gregory Ewing <greg.ewing@canterbury.ac.nz> |
|---|---|
| Date | 2013-11-08 19:47 +1300 |
| Message-ID | <be3foiFqsjtU1@mid.individual.net> |
| In reply to | #58725 |
alex23 wrote: > In [2]: import dis > In [3]: dis.dis(foo) > 2 0 LOAD_GLOBAL 0 (Exception) > 3 RAISE_VARARGS 1 > 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
[toc] | [prev] | [next] | [standalone]
| From | Chris Angelico <rosuav@gmail.com> |
|---|---|
| Date | 2013-11-08 09:55 +1100 |
| Message-ID | <mailman.2164.1383864966.18130.python-list@python.org> |
| In reply to | #58687 |
On Fri, Nov 8, 2013 at 5:38 AM, Nathaniel Sokoll-Ward
<nathanielsokollward@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
[toc] | [prev] | [next] | [standalone]
| From | jskirst@gmail.com |
|---|---|
| Date | 2013-11-07 11:02 -0800 |
| Message-ID | <7299f4a1-56a6-4b18-9630-af1e179f5faf@googlegroups.com> |
| In reply to | #58622 |
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
[toc] | [prev] | [next] | [standalone]
| From | Tim Chase <python.list@tim.thechases.com> |
|---|---|
| Date | 2013-11-07 13:30 -0600 |
| Message-ID | <mailman.2153.1383852564.18130.python-list@python.org> |
| In reply to | #58691 |
On 2013-11-07 11:02, jskirst@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
[toc] | [prev] | [next] | [standalone]
| From | 88888 Dihedral <dihedral88888@gmail.com> |
|---|---|
| Date | 2013-11-07 16:19 -0800 |
| Message-ID | <ceff35ce-1ba7-4033-8187-aa1e3d42548f@googlegroups.com> |
| In reply to | #58691 |
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.
[toc] | [prev] | [next] | [standalone]
| From | MRAB <python@mrabarnett.plus.com> |
|---|---|
| Date | 2013-11-07 01:12 +0000 |
| Message-ID | <mailman.2109.1383786753.18130.python-list@python.org> |
| In reply to | #58601 |
On 07/11/2013 00:59, Chris Angelico wrote:
> On Thu, Nov 7, 2013 at 11:00 AM, Nathaniel Sokoll-Ward
> <nathanielsokollward@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.
>
[toc] | [prev] | [next] | [standalone]
| From | Chris Angelico <rosuav@gmail.com> |
|---|---|
| Date | 2013-11-07 12:17 +1100 |
| Message-ID | <mailman.2110.1383787062.18130.python-list@python.org> |
| In reply to | #58601 |
On Thu, Nov 7, 2013 at 12:12 PM, MRAB <python@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
[toc] | [prev] | [next] | [standalone]
| From | John Ladasky <john_ladasky@sbcglobal.net> |
|---|---|
| Date | 2013-11-06 17:55 -0800 |
| Message-ID | <5a31920a-ffed-4abb-8870-e62e2996f6fa@googlegroups.com> |
| In reply to | #58601 |
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.
[toc] | [prev] | [next] | [standalone]
| From | Chris Angelico <rosuav@gmail.com> |
|---|---|
| Date | 2013-11-07 13:07 +1100 |
| Message-ID | <mailman.2111.1383790074.18130.python-list@python.org> |
| In reply to | #58617 |
On Thu, Nov 7, 2013 at 12:55 PM, John Ladasky <john_ladasky@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
[toc] | [prev] | [next] | [standalone]
| From | Omar Abou Mrad <omar.aboumrad@gmail.com> |
|---|---|
| Date | 2013-11-08 09:09 +0200 |
| Message-ID | <mailman.2188.1383894553.18130.python-list@python.org> |
| In reply to | #58601 |
[Multipart message — attachments visible in raw view] — view raw
On Thu, Nov 7, 2013 at 2:00 AM, Nathaniel Sokoll-Ward < nathanielsokollward@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.
[toc] | [prev] | [next] | [standalone]
| From | Nathaniel Sokoll-Ward <nathanielsokollward@gmail.com> |
|---|---|
| Date | 2013-11-12 09:20 -0800 |
| Message-ID | <mailman.2483.1384276862.18130.python-list@python.org> |
| In reply to | #58601 |
[Multipart message — attachments visible in raw view] — view raw
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.aboumrad@gmail.com>wrote: > > On Thu, Nov 7, 2013 at 2:00 AM, Nathaniel Sokoll-Ward < > nathanielsokollward@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. > >
[toc] | [prev] | [standalone]
Page 2 of 2 — ← Prev page 1 [2]
Back to top | Article view | comp.lang.python
csiph-web