pythontutor.pug
– Code executions step by step¶
View source code on GithubInsert a PythonTutor iframe
¶
mixin tutor(lang="python")
- valid_langs = ["python", "c", "cpp", "java", "javascript", "ruby"];
- if (valid_langs.indexOf(lang) > 0)
- if (lang == "python")
- endpoint = "visualize";
- else
- endpoint = lang;
- else
- throw new Error(lang + " is not a valid language. Valid languages: " + valid_langs);
- if ("alt" in attributes)
- alt = attributes.alt;
- delete attributes.alt;
- else
- alt = true;
iframe(width="100%"
height="500"
frameborder="0"
src=`http://pythontutor.com/${endpoint}.html#cumulative=false&heapPrimitives=nevernest&mode=edit&origin=opt-frontend.js&py=3&rawInputLstJSON=%5B%5D&textReferences=false`)
- if (alt)
| Your browser does not support iframes.
-
+tutor
(lang="python")(width="100%", height="500")¶ Insert a PythonTutor
iframe
passing a language name as first parameter.Arguments: - lang (string) – Code language. Valid languages are:
"python"
,"c"
,"cpp"
,"java"
,"javascript"
,"ruby"
.
- lang (string) – Code language. Valid languages are:
Usage¶
Input
+tutor()
Output
<iframe width="100%" height="500" frameborder="0" src="http://pythontutor.com/visualize.html#cumulative=false&heapPrimitives=nevernest&mode=edit&origin=opt-frontend.js&py=3&rawInputLstJSON=%5B%5D&textReferences=false">Your browser does not support iframes.</iframe>
Render