Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
course_planning:code-testing [2024/01/19 13:27] – caballero | course_planning:code-testing [2024/01/19 13:44] (current) – caballero | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | ====== Basic ====== | + | # Embedded Code Testing |
- | <Code: python> | + | ## Basic |
+ | |||
+ | ### Syntax | ||
+ | |||
+ | ``` | ||
+ | <code python> | ||
+ | {YOUR CODE} | ||
+ | </ | ||
+ | ``` | ||
+ | |||
+ | ### Example | ||
+ | |||
+ | < | ||
Web VPython 3.2 | Web VPython 3.2 | ||
Line 37: | Line 49: | ||
if not (side > ball.pos.z > -side): | if not (side > ball.pos.z > -side): | ||
ball.p.z = -ball.p.z | ball.p.z = -ball.p.z | ||
- | </Code> | + | </code> |
- | ===== With Title and Line Numbers ===== | ||
- | <Code: python | + | ## With Line Numbers and Highlighting |
+ | |||
+ | ### Syntax | ||
+ | |||
+ | ``` | ||
+ | <code python | ||
+ | {YOUR CODE} | ||
+ | </ | ||
+ | ``` | ||
+ | |||
+ | ### Example | ||
+ | |||
+ | <code python [enable_line_numbers=" | ||
Web VPython 3.2 | Web VPython 3.2 | ||
Line 77: | Line 100: | ||
if not (side > ball.pos.z > -side): | if not (side > ball.pos.z > -side): | ||
ball.p.z = -ball.p.z | ball.p.z = -ball.p.z | ||
- | </Code> | + | </code> |
+ | |||
+ | |||
+ | ## With Line Numbers, Highlighting, | ||
+ | |||
+ | ### Syntax | ||
+ | |||
+ | ``` | ||
+ | <code python [enable_line_numbers=" | ||
+ | {YOUR CODE} | ||
+ | </ | ||
+ | ``` | ||
+ | |||
+ | **Note: Highlighting lines uses an absolute number (i.e., the given number of lines sets the length and order starting from 1).** | ||
+ | |||
+ | ### Example | ||
+ | |||
+ | <code python [enable_line_numbers=" | ||
+ | while True: | ||
+ | rate(200) | ||
+ | ball.pos = ball.pos + (ball.p/ | ||
+ | if not (side > ball.pos.x > -side): | ||
+ | ball.p.x = -ball.p.x | ||
+ | if not (side > ball.pos.y > -side): | ||
+ | ball.p.y = -ball.p.y | ||
+ | if not (side > ball.pos.z > -side): | ||
+ | ball.p.z = -ball.p.z | ||
+ | </code> |