|
29 | 29 |
|
30 | 30 | --> |
31 | 31 |
|
32 | | -<!-- |
33 | | -
|
34 | | -myList = (1, (2, (3, None))) |
35 | | -
|
36 | | -def sumList(n, sub): |
37 | | - if not n: |
38 | | - return sub |
39 | | - else: |
40 | | - return sumList(n[1], sub + n[0]) |
41 | | -
|
42 | | -total = sumList(myList, 0) |
43 | | -
|
44 | | ---- |
45 | | -
|
46 | | -myList = (1, (2, (3, None))) |
47 | | -
|
48 | | -def sumList(n): |
49 | | - if not n: |
50 | | - return 0 |
51 | | - else: |
52 | | - return n[0] + sumList(n[1]) |
53 | | -
|
54 | | -total = sumList(myList) |
55 | | -
|
56 | | - --> |
57 | | - |
58 | 32 | <head> |
59 | 33 |
|
60 | | -<title>Online Python Tutor: Learn and practice Python programming in your web browser</title> |
| 34 | +<title>Online Python Tutor: Visually learn Python programming</title> |
61 | 35 |
|
62 | 36 |
|
63 | 37 | <!-- requirements for pytutor.js --> |
|
84 | 58 | <div class="titlePane"> |
85 | 59 |
|
86 | 60 | <h1>Online Python Tutor</h1> |
87 | | -<h2>Learn and practice Python programming in your web browser</h2> |
| 61 | +<h2>Visually learn Python programming</h2> |
88 | 62 |
|
89 | 63 | </div> |
90 | 64 |
|
| 65 | + |
91 | 66 | <div class="mainBodyPane"> |
92 | 67 |
|
| 68 | +<table id='embedShareTable'> |
| 69 | + <tr> |
| 70 | + <td colspan="2"> |
| 71 | + |
93 | 72 | <div class="activityPane" id="learnPane"> |
94 | 73 |
|
95 | | -<h1>Learn</h1> |
96 | | -<h2>Python by writing code and visualizing execution</h2> |
| 74 | +<h1>Learn <span class="smallH1">to program in Python by writing code and visualizing execution</span></h1> |
| 75 | + |
| 76 | +<p>Online Python Tutor allows teachers and students to write <a href="http://www.python.org/">Python</a> |
| 77 | +programs directly in the web browser, execute those programs, step |
| 78 | +<b>forwards and backwards</b> through execution to view the run-time |
| 79 | +state of data structures, and share their visualizations on the web.</p> |
97 | 80 |
|
98 | | -<p>This free educational application allows teachers and students to |
99 | | -write Python scripts directly in the web browser, execute those scripts, |
100 | | -single-step <b>forwards and backwards</b> through execution, and view |
101 | | -the run-time state of all data structures.</p> |
| 81 | +<p>Rather than simply displaying a text-based console, Online Python |
| 82 | +Tutor visualizes stack frames, variables, and heap objects. For example, |
| 83 | +here is a recursive function that sums linked list elements:</p> |
102 | 84 |
|
103 | | -<p>Rather than displaying a bland text-based console, the Online Python |
104 | | -Tutor provides a rich visualization of variables, heap objects, and |
105 | | -stack frames. For example, the following code:</p> |
| 85 | +<div id="demoViz"></div> |
106 | 86 |
|
| 87 | +<p>Since its inception in January 2010, over 100,000 people have used |
| 88 | +Online Python Tutor to understand and debug their programs. In addition, |
| 89 | +instructors in over a dozen universities including MIT, UC Berkeley, UC |
| 90 | +Davis, Sonoma State University, the University of Washington, the |
| 91 | +University of Waterloo, the University of Toronto, Luther College, and |
| 92 | +Swarthmore College have adopted it for teaching introductory computer |
| 93 | +science courses.</p> |
107 | 94 |
|
108 | | -<div id="demoViz"/> |
| 95 | +</p> |
109 | 96 |
|
110 | | -<h3><a href="tutor.html">Go play with the Online Python Tutor!</a></h3> |
| 97 | +<h3><a href="tutor.html">Start using Online Python Tutor now</a></h3> |
111 | 98 |
|
112 | 99 | </div> |
113 | 100 |
|
114 | | -<div class="activityPane" id="solvePane"> |
115 | 101 |
|
116 | | -<h1>Solve</h1> |
117 | | -<h2>programming problems by writing Python code</h2> |
118 | 102 |
|
119 | | -<p>The Online Python Tutor also allows students to practice solving |
120 | | -programming problems like those they would receive for class assignments |
121 | | -or technical job interviews.</p> |
| 103 | + </td> |
| 104 | + </tr> |
122 | 105 |
|
123 | | -<p>It provides web-based interfaces for writing solution and test code, |
124 | | -executing on a series of graded test inputs, and showing what tests |
125 | | -passed and failed.</p> |
| 106 | + <tr> |
| 107 | + <td width="60%"> |
126 | 108 |
|
127 | | -<p>The above screenshot shows passed and failed tests. The user can |
128 | | -click on the "Debug me" button besides one of the sad faces to debug why |
129 | | -the program failed on a particular test.</p> |
| 109 | +<div class="activityPane" id="embedPane"> |
130 | 110 |
|
131 | | -<p>Here are some sample practice problems:</p> |
| 111 | +<h1>Embed <span class="smallH1">visualizations in digital textbooks and course lessons</span></h1> |
132 | 112 |
|
133 | | -<ul> |
| 113 | +<p>Using just one line of JavaScript code, you can embed an Online |
| 114 | +Python Tutor visualization within your web page. For example, the |
| 115 | +HTML textbook for the introductory CS course at UC Berkeley (<a |
| 116 | +href="http://www-inst.eecs.berkeley.edu/~cs61a/">CS61A</a>) contains |
| 117 | +dozens of embedded visualizations: |
134 | 118 |
|
135 | | -<li><a href="question.html?two-sum">Two-sum</a></li> |
136 | | -<li><a href="question.html?reverse">Reverse list</a></li> |
137 | | -<li><a href="question.html?remove-dups">Remove duplicate characters</a></li> |
| 119 | +</p> |
138 | 120 |
|
139 | | -</ul> |
| 121 | +<a href="http://inst.eecs.berkeley.edu/~cs61A-tz/book/chapters/objects.html#nested-pairs"> |
| 122 | +<img src="opt-v3-cs61a-embed.png" style="border: 1px solid #aaa"/> |
| 123 | +</a> |
| 124 | +<p> |
| 125 | + |
| 126 | +These visualizations have also been embedded within two other web-based |
| 127 | +digital Python textbook projects: <a |
| 128 | +href="http://interactivepython.org/courselib/static/thinkcspy/index.html">How |
| 129 | +to Think Like a Computer Scientist: Interactive Edition</a> and <a |
| 130 | +href="http://cscircles.cemc.uwaterloo.ca/">Computer Science Circles</a>. |
| 131 | +These textbooks collectively attract around 16,000 unique viewers per |
| 132 | +month and are being used in at least 25 universities around the world. |
| 133 | + |
| 134 | +</p> |
| 135 | + |
| 136 | +</div> |
| 137 | + |
| 138 | + |
| 139 | +<div id="footer"> |
| 140 | + |
| 141 | +<p>Copyright © 2010-2012 <a href="http://www.pgbovine.net/">Philip Guo</a>. All rights reserved.</p> |
140 | 142 |
|
141 | 143 | </div> |
142 | 144 |
|
143 | | -<div class="activityPane" id="debugPane"> |
144 | 145 |
|
145 | | -<h1>Debug</h1> |
146 | | -<h2>existing programs that almost work properly</h2> |
| 146 | + </td> |
| 147 | + <td width="40%"> |
147 | 148 |
|
148 | | -<p>Using the Online Python Tutor's bidirectional single-stepping and |
149 | | -data structure visualization capabilities, students can practice |
150 | | -debugging, an important skill which is rarely covered in web-based |
151 | | -programming problems.</p> |
| 149 | +<div class="activityPane" id="sharePane"> |
152 | 150 |
|
153 | | -<p>They can work on problems like, <i>"Change at most 2 lines of code to |
154 | | -make this almost-correct Python program work properly."</i> Here are |
155 | | -some sample debugging problems:</p> |
| 151 | +<h1>Share <span class="smallH1">visualizations online</span></h1> |
156 | 152 |
|
157 | | -<ul> |
| 153 | +<p>To share your current visualization, click the “Generate |
| 154 | +URL” button and send that URL link in an email, social networking |
| 155 | +post, or forum thread. When recipients click on that link, they will see |
| 156 | +exactly what you are looking at. This is a more effective way for |
| 157 | +students to seek assistance than simply copying-and-pasting code.</p> |
158 | 158 |
|
159 | | -<li><a href="question.html?debug-ireverse">In-place reverse</a></li> |
160 | | -<li><a href="question.html?debug-bsearch">Binary search</a></li> |
161 | | -<li><a href="question.html?debug-mergesort">Mergesort</a></li> |
| 159 | +<p> For example, clicking <a |
| 160 | +href="http://www.pythontutor.com/tutor.html#code=%23+find+primes+using+a+for-else+construct%0Afor+n+in+range(2,+10)%3A%0A++++x_range+%3D+range(2,+n)%0A++++for+x+in+x_range%3A%0A++++++++if+n+%25+x+%3D%3D+0%3A%0A++++++++++++break%0A++++else%3A%0A++++++++%23+loop+fell+through+without+finding+a+factor%0A++++++++print(n)&curInstr=43&mode=visualize&cumulative_mode=false&python_version=2">this |
| 161 | +link</a> brings you directly to step 44 of 57 in a program to find prime |
| 162 | +numbers using the Python <tt>for-else</tt> construct.</p> |
162 | 163 |
|
163 | | -</ul> |
| 164 | +<p>In the future, we plan to create an authoring environment where you |
| 165 | +can add annotations, discussion threads, and even interactive activities |
| 166 | +on top of your visualizations.</p> |
164 | 167 |
|
165 | 168 | </div> |
166 | 169 |
|
167 | | -</div> |
168 | 170 |
|
| 171 | +<div class="activityPane" id="detailsPane"> |
169 | 172 |
|
170 | | -<div id="footer"> |
| 173 | +<h2>More Details</h2> |
171 | 174 |
|
172 | | -<p>Source code and documentation are in this <a |
173 | | -href="https://github.com/pgbovine/OnlinePythonTutor/">GitHub |
174 | | -repository</a>.</p> |
| 175 | +<p> |
175 | 176 |
|
176 | | -<p>Join ___ (low-traffic) Google Group to receive project announcements.</p> |
| 177 | +<ul> |
| 178 | + |
| 179 | + <li/>Supports Python <a href="http://www.python.org/doc/2.7/">2.7</a> |
| 180 | + and <a href="http://www.python.org/doc/3.2/">3.2</a> with limited |
| 181 | + module imports and no file I/O |
| 182 | + |
| 183 | + <li/>BSD-licensed source code available in this <a |
| 184 | + href="https://github.com/pgbovine/OnlinePythonTutor/">GitHub |
| 185 | + repository</a> |
| 186 | + |
| 187 | + <li/>Main technologies: Python <tt><a |
| 188 | + href="http://docs.python.org/library/bdb.html">bdb</a></tt> debugger |
| 189 | + framework for backend execution trace generation, <a |
| 190 | + href="http://www.d3js.org/">D3.js</a> for frontend data management and |
| 191 | + visualization, <a href="http://www.jsplumb.org/">jsPlumb</a> for |
| 192 | + graphical arrow rendering, and <a |
| 193 | + href="http://codemirror.net/">CodeMirror</a> for syntax highlighting. |
| 194 | + |
| 195 | + <li/>Join our low-traffic Google Group to receive project announcements. |
| 196 | + |
| 197 | + <li/>To report bugs, email bugs@pythontutor.com |
| 198 | + |
| 199 | +</ul> |
177 | 200 |
|
178 | | -<p> |
179 | | -Copyright © 2010-2012 <a href="http://www.pgbovine.net/">Philip |
180 | | -Guo</a> (philip@pgbovine.net). All rights reserved. |
181 | 201 | </p> |
182 | 202 |
|
183 | | -<p>Special thanks to ___</p> |
| 203 | +</div> |
| 204 | + |
| 205 | + |
| 206 | + </td> |
| 207 | + |
| 208 | + </tr> |
| 209 | +</table> |
184 | 210 |
|
185 | 211 | </div> |
186 | 212 |
|
| 213 | + |
187 | 214 | </body> |
188 | 215 | </html> |
189 | 216 |
|
0 commit comments