| <html lang="en"> | |
| <head> | |
| <meta charset="UTF-8"> | |
| <title>Python Visualizer</title> | |
| <link rel="stylesheet" href="/static/style.css"> | |
| </head> | |
| <body> | |
| <h2>🧠 Python Visualizer</h2> | |
| <form method="post" action="/run"> | |
| <textarea name="code" rows="10" cols="70" placeholder="Enter Python code here...">{{ code or '' }}</textarea><br> | |
| <button type="submit">Run Code</button> | |
| </form> | |
| {% if trace %} | |
| <h3>Execution Trace:</h3> | |
| <ol> | |
| {% for step in trace %} | |
| {% if step.error %} | |
| <li style="color:red;">Error: {{ step.error }}</li> | |
| {% else %} | |
| <li> | |
| <strong>Line {{ step.line }}</strong> → Locals: {{ step.locals }} | |
| </li> | |
| {% endif %} | |
| {% endfor %} | |
| </ol> | |
| {% endif %} | |
| {% if output %} | |
| <h3>Output:</h3> | |
| <pre>{{ output }}</pre> | |
| {% endif %} | |
| </body> | |
| </html> | |