Computer Science A
Course Progress
0/0
OCS Build and Lesson
Code Runner - Java
Code Runner - Examples
Code Runner - JavaScript
FRQ - Methods and Control Structures
Challenge Submission Test
2021 FRQ 3
2023 FRQ 3
2024 FRQ 3
2024 FRQ 2
2024 FRQ 1
2024 FRQ 4
FRQ 2 - Sign Class
2023 FRQ 1
2021 FRQ 2
2019 FRQ 4
2019 FRQ 2
2019 FRQ 1
2016 FRQ 3
2018 FRQ Question 4
2018 FRQ Question 3
2018 FRQ Question 2
2018 FRQ Question 1
2017 FRQ 4
2017 FRQ 3
2017 FRQ Question 2
2017 FRQ 1
2016 FRQ 4
2016 FRQ 2
2016 FRQ Q1
FRQ - 2D Arrays
FRQ - ArrayLists
2025 FRQ 4
2025 FRQ 3
2025 FRQ 2
2025 FRQ 1
FRQ - Classes
FRQ - Array
2023 FRQ 4
2022 FRQ 4
2022 FRQ 3
2022 FRQ 2
2022 FRQ 1
2021 FRQ 4
2021 FRQ 1
2015 FRQ 4
2015 FRQ 2
2015 FRQ 1
2015 FRQ 3
2014 FRQ Q2 - Writing a Class
2019 FRQ 3
2014 FRQ 1
Sprint View
Week 17
Code Runner - Examples
Code Runner - Examples
2 min read
Python Lesson: Fix the Syntax Error
Code Runner Challenge
Fix the syntax error. Run the code to get a hint!
Lines: 1
Characters: 0
Output
Click "Run" in code control panel to see output ...
Python Lesson: Complete the Function
Code Runner Challenge
Complete the function to calculate the area of a rectangle. Replace the ??? with the correct calculation.
Lines: 1
Characters: 0
Output
Click "Run" in code control panel to see output ...
Java Lesson: Fix the Compilation Error
Code Runner Challenge
The code has a compilation error. Fix it!
Lines: 1
Characters: 0
Output
Click "Run" in code control panel to see output ...
JavaScript Lesson: Complete the Loop
Code Runner Challenge
Complete the for loop to print numbers 1 through 5. Fill in the missing parts of the loop.
Lines: 1
Characters: 0
Output
Click "Run" in code control panel to see output ...
Code Runner Reference
Code runner requires defining and passing liquid variables for challenge and code to the include file code-runner.html. Study the source of this markdown file to see how the liquid variables are defined for each example above.
Parameters
- runner_id (required): Unique ID for each runner on the page (e.g., “exercise1”, “exercise2”)
- language (optional): “python”, “java”, or “javascript” (defaults to “python”)
- challenge: Variable containing the challenge/instruction text
- code: Variable containing the starter code
- height (optional): Editor height (defaults to “300px”)
Code Runner Architecture
HTML Component
- File:
_includes/code-runner.html - Reusable component with parameters for customization
- Uses CodeMirror for syntax highlighting
SCSS Styling
- Main file:
_sass/open-coding/forms/code-runner.scss - Uses mixins for consistent styling across lessons:
@mixin control-panel- Top/bottom toolbars with buttons@mixin sub-container- Groups editor/output sections@mixin info-panel- Challenge box styling@mixin output-panel- Code output display@mixin icon-button- Consistent button styling@mixin select-control- Dropdown menus
Color Variables
- File:
_sass/open-coding/user-preferences.scss -
Uses colors that correspond to user preferences
--pref-bg-color- Background color--pref-text-color- Text color--pref-accent-color- Accent/emphasis color--ui-border- Border color--panel- Panel background