Skip to content

Commit 44abc87

Browse files
committed
added beginnings of demo site
1 parent 9eb2789 commit 44abc87

3 files changed

Lines changed: 539 additions & 0 deletions

File tree

‎v3/css/pytutor-title.css‎

Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
/* CSS accompanying ../index.html */
2+
3+
body {
4+
background-color: white;
5+
6+
line-height: 1.5; /* slightly more than single spacing, for prose text */
7+
font-family: Georgia, Palatino, Times, serif;
8+
9+
font-size: 12pt;
10+
max-width: 900px;
11+
margin-left: auto;
12+
margin-right: auto;
13+
}
14+
15+
16+
h1 {
17+
font-weight: normal;
18+
font-size: 20pt;
19+
line-height: 1em; /* enforce single spacing so that Georgia works */
20+
21+
margin-top: 0px;
22+
margin-bottom: 8px;
23+
}
24+
25+
h2 {
26+
font-size: 12pt;
27+
font-weight: normal;
28+
29+
margin-top: 2px;
30+
margin-bottom: 20px;
31+
}
32+
33+
.titlePane {
34+
margin-left: auto;
35+
margin-right: auto;
36+
margin-bottom: 25px;
37+
text-align: center;
38+
}
39+
40+
.titlePane h2 {
41+
margin-top: 8px;
42+
}
43+
44+
div.mainBodyPane {
45+
width: 100%;
46+
margin-left: auto;
47+
margin-right: auto;
48+
}
49+
50+
div.activityPane {
51+
/* TOP RIGHT BOTTOM LEFT */
52+
padding: 15px 20px 5px 20px;
53+
margin-top: 30px;
54+
text-align: left;
55+
border: 3px solid #005583;
56+
}
57+
58+
59+
ul {
60+
padding-left: 18px;
61+
}
62+
63+
li {
64+
margin-bottom: 6px;
65+
font-size: 11pt;
66+
}
67+
68+
a,
69+
a:visited,
70+
a:hover {
71+
color: #3D58A2;
72+
}
73+
74+
#footer {
75+
color: #666666;
76+
font-size: 9pt;
77+
border-top: 1px solid #bbbbbb;
78+
padding-top: 5px;
79+
margin-top: 15px;
80+
81+
max-width: 100%;
82+
/* center align */
83+
margin-left: auto;
84+
margin-right: auto;
85+
86+
font-family: verdana, arial, helvetica, sans-serif;
87+
}
88+
89+
90+
/* necessary for CodeMirror error line highlighting to work! */
91+
.CodeMirror .errorLine { background: #ffff3f !important; }

‎v3/index.html‎

Lines changed: 199 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,199 @@
1+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
2+
<html xmlns="http://www.w3.org/1999/xhtml">
3+
4+
<!--
5+
6+
Online Python Tutor
7+
https://github.com/pgbovine/OnlinePythonTutor/
8+
9+
Copyright (C) 2010-2012 Philip J. Guo (philip@pgbovine.net)
10+
11+
Permission is hereby granted, free of charge, to any person obtaining a
12+
copy of this software and associated documentation files (the
13+
"Software"), to deal in the Software without restriction, including
14+
without limitation the rights to use, copy, modify, merge, publish,
15+
distribute, sublicense, and/or sell copies of the Software, and to
16+
permit persons to whom the Software is furnished to do so, subject to
17+
the following conditions:
18+
19+
The above copyright notice and this permission notice shall be included
20+
in all copies or substantial portions of the Software.
21+
22+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
23+
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
24+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
25+
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
26+
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
27+
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
28+
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
29+
30+
-->
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+
<head>
59+
60+
<title>Online Python Tutor: Learn and practice Python programming in your web browser</title>
61+
62+
63+
<!-- requirements for pytutor.js -->
64+
<script type="text/javascript" src="js/d3.v2.min.js"></script>
65+
<script type="text/javascript" src="js/jquery-1.6.min.js"></script>
66+
<script type="text/javascript" src="js/jquery.ba-bbq.min.js"></script> <!-- for handling back button and URL hashes -->
67+
<script type="text/javascript" src="js/jquery.jsPlumb-1.3.10-all-min.js "></script> <!-- for rendering SVG connectors -->
68+
<script type="text/javascript" src="js/jquery-ui-1.8.21.custom.min.js"></script> <!-- for sliders and other UI elements -->
69+
<link type="text/css" href="css/ui-lightness/jquery-ui-1.8.21.custom.css" rel="stylesheet" />
70+
71+
<script type="text/javascript" src="js/pytutor.js"></script>
72+
<link rel="stylesheet" href="css/pytutor.css"/>
73+
74+
<script type="text/javascript" src="js/jquery.corner.js"></script>
75+
76+
<script type="text/javascript">
77+
$(document).ready(function() {
78+
// for rounded corners
79+
$(".activityPane").corner('15px');
80+
});
81+
</script>
82+
83+
<link rel="stylesheet" href="css/pytutor-title.css"/>
84+
85+
</head>
86+
87+
<body>
88+
89+
<div class="titlePane">
90+
91+
<h1>Online Python Tutor</h1>
92+
<h2>Learn and practice Python programming in your web browser</h2>
93+
94+
</div>
95+
96+
<div class="mainBodyPane">
97+
98+
<div class="activityPane" id="learnPane">
99+
100+
<h1>Learn</h1>
101+
<h2>Python by writing code and visualizing execution</h2>
102+
103+
<p>This free educational application allows teachers and students to
104+
write Python scripts directly in the web browser, execute those scripts,
105+
single-step <b>forwards and backwards</b> through execution, and view
106+
the run-time state of all data structures.</p>
107+
108+
<p>Rather than displaying a bland text-based console, the Online Python
109+
Tutor provides a rich visualization of variables, heap objects, and
110+
stack frames. For example, the following code:</p>
111+
112+
<pre>
113+
x = ["Alice", "Bob", "Charlie"]
114+
y = x
115+
z = ["Alice", "Bob", "Charlie"]
116+
</pre>
117+
118+
<p>will be visualized as the following HTML diagram, which properly shows
119+
aliasing relationships:</p>
120+
121+
122+
<h3><a href="tutor.html">Go play with the Online Python Tutor!</a></h3>
123+
124+
</div>
125+
126+
<div class="activityPane" id="solvePane">
127+
128+
<h1>Solve</h1>
129+
<h2>programming problems by writing Python code</h2>
130+
131+
<p>The Online Python Tutor also allows students to practice solving
132+
programming problems like those they would receive for class assignments
133+
or technical job interviews.</p>
134+
135+
<p>It provides web-based interfaces for writing solution and test code,
136+
executing on a series of graded test inputs, and showing what tests
137+
passed and failed.</p>
138+
139+
<p>The above screenshot shows passed and failed tests. The user can
140+
click on the "Debug me" button besides one of the sad faces to debug why
141+
the program failed on a particular test.</p>
142+
143+
<p>Here are some sample practice problems:</p>
144+
145+
<ul>
146+
147+
<li><a href="question.html?two-sum">Two-sum</a></li>
148+
<li><a href="question.html?reverse">Reverse list</a></li>
149+
<li><a href="question.html?remove-dups">Remove duplicate characters</a></li>
150+
151+
</ul>
152+
153+
</div>
154+
155+
<div class="activityPane" id="debugPane">
156+
157+
<h1>Debug</h1>
158+
<h2>existing programs that almost work properly</h2>
159+
160+
<p>Using the Online Python Tutor's bidirectional single-stepping and
161+
data structure visualization capabilities, students can practice
162+
debugging, an important skill which is rarely covered in web-based
163+
programming problems.</p>
164+
165+
<p>They can work on problems like, <i>"Change at most 2 lines of code to
166+
make this almost-correct Python program work properly."</i> Here are
167+
some sample debugging problems:</p>
168+
169+
<ul>
170+
171+
<li><a href="question.html?debug-ireverse">In-place reverse</a></li>
172+
<li><a href="question.html?debug-bsearch">Binary search</a></li>
173+
<li><a href="question.html?debug-mergesort">Mergesort</a></li>
174+
175+
</ul>
176+
177+
</div>
178+
179+
</div>
180+
181+
182+
<div id="footer">
183+
184+
<p>Source code and documentation are in this <a
185+
href="https://github.com/pgbovine/OnlinePythonTutor/">GitHub
186+
repository</a>.</p>
187+
188+
<p>
189+
Copyright &copy; 2010-2012 <a href="http://www.pgbovine.net/">Philip
190+
Guo</a> (philip@pgbovine.net). All rights reserved.
191+
</p>
192+
193+
<p>Special thanks to ___</p>
194+
195+
</div>
196+
197+
</body>
198+
</html>
199+

0 commit comments

Comments
 (0)