Live data from Hacker News

Online Python Tutor

people.csail.mit.edu

21–30 of 50 posts

Re: Online Python Tutor

#21
post #9

The tool is awesome, but I wouldn't rely too much on the instruction bounds. For example, the greatest sums exercise ( http://people.csail.mit.edu/pgbovine/python/question.html?op... ) can be solved in six "steps" for all input lengths, while it's certainly no O(1) business. def maxPairSum(data): return sum(sorted(data)[-2:]) # one "step"

Actually, both your solution and theirs are not O(1). Theirs is n^2, while yours is n lg n due to the use of a sort function. The best way to do this would simply be to find the largest element, ignore that element and find the largest element again, which is O(n).

I'm perfectly aware, but can you take that approach and execute it in 6 "steps" for all data sizes?

Since the whole point of the exercise is "optimizing" maxPairSum so that it runs in 20 "steps" or less, I guess this slower solution is still more "optimized" - which was my whole point, after all. :)

(Please note 6 steps is the bare minimum - one for the function definition, one for preparing input, one for calling the function, one for calling the function, one for assigning function arguments, one for the actual function and one for returning from the function. You can't go shorter than this.)

Re: Online Python Tutor

#24
whoa what a pleasant surprise seeing my project on the HN front page this morning! just an FYI: this is a "demo-quality" project, not production-quality. it's probably not ready for HN-level traffic! please email me if you have more detailed suggestions or bug reports, thanks.

Re: Online Python Tutor

#25
post #2

This is awesome. Would be cool to see a version for a lower level language like C that would help people understand the stack and visualize pointer arithmetic.

If you found this awesome, Bret Victor will blow your mind (the coding tool is the third example): http://vimeo.com/36579366

Re: Online Python Tutor

#26
post #7

Although I like these kind of tools, I doubt that they're useful to learn basic programming as they need a lot of prior knowledge to be present to already understand the visualization. For example, what is a stack or heap to a novice programmer? What will the effect of this visualization be on their construction of an operational understanding of basic programming language concepts? And these constructs, will they be…

The diagrams used here are similar in style and content to the environment diagrams used in SICP (Structure and Interpretation of Computer Programs), which is an introductory (and quite comprehensive) CS text. At Berkeley at least -- and I think MIT as well -- SICP is taught in a course taken by both majors and non-majors are taking CS courses.

Re: Online Python Tutor

#29
It is great that Hacker News has caught up with this -- Philip has done a great job with the Python Tutor. Next step: user-definable layout for display of different data types.
Post reply on HN