|
1 |
| -# Insert Tutorial's Title here |
| 1 | +# Basic Python Example |
2 | 2 |
|
3 |
| -Short description to be shown as a tutorial's subtitle |
| 3 | +A test to try Python with CodeRoad |
4 | 4 |
|
5 |
| -## L1 Put Level's title here |
| 5 | +## L1 Add some numbers together |
6 | 6 |
|
7 |
| -> Level's summary: a short description of the level's content in one line. |
| 7 | +> Test out the basics |
8 | 8 |
|
9 |
| -The level is identified and distributed following the regex: |
10 | 9 |
|
11 |
| -```js |
12 |
| -/^(##\s(?<levelId>L\d+)\s(?<levelTitle>.*)\n*(>\s*(?<levelSummary>.*))?\n+(?<levelContent>[^]*))/; |
13 |
| -``` |
14 |
| - |
15 |
| -The Level can be split into steps or have no steps. Levels without steps are meant to be used as only informative content, for example: use a Level without steps at the end of the tutorial to congratulate the student and provide some additional related resources. |
16 |
| - |
17 |
| -Tutorial's content. It can span through multiple paragraphs and use headers `####` and `#####`. |
18 | 10 |
|
19 |
| -Steps are identified and their content described using the following regex: |
| 11 | +This is just a test, so here's the answer: |
20 | 12 |
|
21 |
| -```js |
22 |
| -/^(###\s(?<stepId>(?<levelId>L\d+)S\d+)\s(?<stepTitle>.*)\n+(?<stepContent>[^]*))/; |
| 13 | +```py |
| 14 | +def add(*args): |
| 15 | + '''Add 1 or more numbers together''' |
| 16 | + total = 0 |
| 17 | + for arg in args: |
| 18 | + total += arg |
| 19 | + return total |
23 | 20 | ```
|
24 | 21 |
|
25 |
| -The numbers identifying the levels and steps are irrelevant but keep in mind that they will be executed in order. A level with id `10` will be executed before another one with id `20` and so on. These `ids` should have a match in the configuration file (`coderoad.yaml`). |
26 |
| - |
27 |
| -### L1S1 A step title (not being shown on the extension at this moment) |
28 |
| - |
29 |
| -Short description of the step's purpose. Should be short and fit in one line |
30 |
| - |
31 |
| -**Important** |
| 22 | +### L1S1 Add |
32 | 23 |
|
33 |
| -1. Both level and step ids must have an entry with the same id on the configuration file; |
34 |
| -2. Step Ids are based on its level id. Any step from level `L234` must start with `L234S`, followed by the sequential digits. |
| 24 | +Complete the `add` function. It should be able to add one or more numbers together. |
| 25 | +For example: `add(1) = 1`, `add(1, 2) = 3`, and `add(1, 2, 3) = 6`. |
0 commit comments