You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Added chapter 4 and modified the content generation to hide the drawing area from the skulpt templates if no drawing is needed. The textarea now fills the entire width of the content area.
- The Python code inside `<textarea>` must match the Sample Code block exactly
481
-
- Do not add inline `<style>`or`<script>` tags — allCSS/JSis centralized
482
-
- The first lab on a page uses the plain IDs above — `skulpt.js` depends on them
483
-
-**Do notset a `height`or`rows` attribute on the `<textarea>`** — `skulpt.js` counts the lines of code on page load and sets the textarea height automatically so all code is visible without scrolling
531
+
-**Do notset a `height`or`rows` attribute on the `<textarea>`** — `skulpt.js` auto-sizes it on page load so all code is visible without scrolling
532
+
- The first lab on a page uses the plain IDs above; `skulpt.js` depends on them
484
533
485
-
**Multiple labs on one page (Learning Checks, etc.):**
534
+
#### Multiple labs on one page (Learning Checks, etc.)
486
535
487
-
Every lab after the first must use a `-2`, `-3`, … suffix on every ID, andpass
488
-
the matching suffix to the button `onclick` handlers:
536
+
Every lab after the first must use a `-2`, `-3`, … suffix on **every**ID, andpass
537
+
the matching suffix to the button `onclick` handlers. The `skulpt-text-only`class
538
+
applies to multiple labs independently — a page may have a drawing lab first and a
Three traps beginners fall into: (1) single-letter names like `x` or `n` that tell you nothing, (2) capital letters that break the snake_case style Python expects, and (3) accidentally naming a variable after a Python keyword. If Python gives you a `SyntaxError` the moment you assign a value, check whether your variable name is a keyword like `print` or `list`!
169
+
Watch out for the dash! If you write `my-score` instead of `my_score`, Python reads the dash as a minus sign and thinks you are subtracting a variable called `score` from a variable called `my`. Use an **underscore** (`_`), never a dash (`-`), to join words in a name. Other common traps: single-letter names like `x` that tell you nothing, capital letters that break snake_case, and accidentally using a Python keyword as your variable name.
The program below creates two variables — `player_score` and `bonus_points`. It prints `player_score` just fine, but something is missing: `bonus_points` never gets printed. Add **one line** so the output shows both numbers, one on each line.
0 commit comments