Skip to content

Commit

Permalink
add level 7, update layout
Browse files Browse the repository at this point in the history
  • Loading branch information
Felienne committed Nov 9, 2024
1 parent 6e7f8fb commit 371c8f5
Show file tree
Hide file tree
Showing 4 changed files with 250 additions and 9 deletions.
117 changes: 117 additions & 0 deletions content/pages/en.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2171,3 +2171,120 @@ workbooks:
- type : question
text : "What didn't you like about it?"
lines : 5
- level: '7'
intro: |-
## Herhalen!
Aan het einde van de les kan jij:
* een regel code meerdere keren uit kan voeren
exercises:
- type: text
contents: |-
### Herhaling
Soms wil je één regel code meerdere keren herhalen, bijvoorbeeld in een liedje of verhaal.
code: |-
repeat 5 times print 'Baby shark!'
- type: text
contents: |-
#### Opdracht 1: Voorspel de uitvoer
Wat is de uitvoer van deze programma's?
- type: output
code: |-
repeat 3 times print 'Baby shark!'
answer: |-
Baby shark!
Baby shark!
Baby shark!
lines: 3
- type: output
code: |-
repeat 1 times print 'Hallo allemaal!'
answer: |-
Hallo allemaal!
lines: 1
- type: output
code: |-
a is 4
repeat a times print 'Hallo allemaal!'
answer: |-
Hallo allemaal!
Hallo allemaal!
Hallo allemaal!
Hallo allemaal!
lines: 4
- type: text
contents: |
### Opdracht 2: Invoer
Je krijgt nu weer een uitvoer te zien. Schrijf een programma dat bij deze uitvoer kan horen.
Let op: vaak zijn er meerdere antwoorden goed, je mag zelf iets kiezen, als het maar kan.
Kijk ook goed naar het aantal streepjes!
- type: input
answer: |-
print 'Hallo allemaal!'
repeat 2 times print 'Dit is een regel'
output: |-
Hallo allemaal!
Dit is een regel
Dit is een regel
lines: 2
- type: input
answer: |-
print 'Dit is regel 1'
print 'Dit is regel 2'
print 'Dit is regel 3'
output: |-
Dit is regel 1
Dit is regel 2
Dit is regel 3
lines: 3
- type: text
contents: |-
### Opdracht 3: Goed of fout?
Lees de code goed, en bepaal of deze code een foutmelding oplevert.
- type : MC-code
options : ["Goed" , "Fout"]
code : |-
print 'De prins riep steeds om hulp'
repeat 3 times 'Help!'
answer : Fout, print mist
- type : MC-code
options : ["Goed" , "Fout"]
code : |-
forward 100
repeat 3 times turn 90
answer : Goed
- type : MC-code
options : ["Goed" , "Fout"]
code : |-
mensen = mama, papa, Emma, Sophie
repeat 7 times print 'De afwasser is ' mensen
answer : Fout, at random mist
- type : MC-code
options : ["Goed" , "Fout"]
code : |-
dobbel = 1, 2, 3, 4, 5, 6
repeat 5 times print 'Jij gooit: ' dobbel at random
answer : Goed
- type: text
contents: |-
#### Opdracht 4: Programmeerwoorden
We hebben deze les een nieuw programmeerwoord geleerd: `repeat`.
- type: repeat
word: "keer"
answer: "een regel code herhalen"
lines: 1
- type: text
contents: |-
#### Wat vond jij?
- type: question
text: "Wat was de leukste opdracht van dit level?"
lines: 1
- type: question
text: "Waarom vond je juist die opdracht leuk?"
lines: 5
- type: question
text: "Welke opdracht was het minst leuk?"
lines: 1
- type: question
text: "Waarom vond je juist die opdracht niet leuk?"
lines: 5
117 changes: 117 additions & 0 deletions content/pages/nl.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2191,3 +2191,120 @@ workbooks:
- type: question
text: "Waarom vond je juist die opdracht niet leuk?"
lines: '5'
- level: '7'
intro: |-
## Herhalen!
Aan het einde van de les kan jij:
* een regel code meerdere keren uit kan voeren
exercises:
- type: text
contents: |-
### Herhaling
Soms wil je één regel code meerdere keren herhalen, bijvoorbeeld in een liedje of verhaal.
code: |-
repeat 5 times print 'Baby shark!'
- type: text
contents: |-
#### Opdracht 1: Voorspel de uitvoer
Wat is de uitvoer van deze programma's?
- type: output
code: |-
repeat 3 times print 'Baby shark!'
answer: |-
Baby shark!
Baby shark!
Baby shark!
lines: 3
- type: output
code: |-
repeat 1 times print 'Hallo allemaal!'
answer: |-
Hallo allemaal!
lines: 1
- type: output
code: |-
a is 4
repeat a times print 'Hallo allemaal!'
answer: |-
Hallo allemaal!
Hallo allemaal!
Hallo allemaal!
Hallo allemaal!
lines: 4
- type: text
contents: |
### Opdracht 2: Invoer
Je krijgt nu weer een uitvoer te zien. Schrijf een programma dat bij deze uitvoer kan horen.
Let op: vaak zijn er meerdere antwoorden goed, je mag zelf iets kiezen, als het maar kan.
Kijk ook goed naar het aantal streepjes!
- type: input
answer: |-
print 'Hallo allemaal!'
repeat 2 times print 'Dit is een regel'
output: |-
Hallo allemaal!
Dit is een regel
Dit is een regel
lines: 2
- type: input
answer: |-
print 'Dit is regel 1'
print 'Dit is regel 2'
print 'Dit is regel 3'
output: |-
Dit is regel 1
Dit is regel 2
Dit is regel 3
lines: 3
- type: text
contents: |-
### Opdracht 3: Goed of fout?
Lees de code goed, en bepaal of deze code een foutmelding oplevert.
- type : MC-code
options : ["Goed" , "Fout"]
code : |-
print 'De prins riep steeds om hulp'
repeat 3 times 'Help!'
answer : Fout, print mist
- type : MC-code
options : ["Goed" , "Fout"]
code : |-
forward 100
repeat 3 times turn 90
answer : Goed
- type : MC-code
options : ["Goed" , "Fout"]
code : |-
mensen = mama, papa, Emma, Sophie
repeat 7 times print 'De afwasser is ' mensen
answer : Fout, at random mist
- type : MC-code
options : ["Goed" , "Fout"]
code : |-
dobbel = 1, 2, 3, 4, 5, 6
repeat 5 times print 'Jij gooit: ' dobbel at random
answer : Goed
- type: text
contents: |-
#### Opdracht 4: Programmeerwoorden
We hebben deze les een nieuw programmeerwoord geleerd: `repeat`.
- type: repeat
word: "keer"
answer: "een regel code herhalen"
lines: 1
- type: text
contents: |-
#### Wat vond jij?
- type: question
text: "Wat was de leukste opdracht van dit level?"
lines: 1
- type: question
text: "Waarom vond je juist die opdracht leuk?"
lines: 5
- type: question
text: "Welke opdracht was het minst leuk?"
lines: 1
- type: question
text: "Waarom vond je juist die opdracht niet leuk?"
lines: 5
13 changes: 9 additions & 4 deletions templates/workbooks.html
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
<h4 id="{{exercise.title|slugify}}">{{ exercise.icon}} {{ exercise.title }}</h4>
{{ exercise.text|commonmark }}
<table>
<table border="1">
<tr>
<td width='5000px'>
{% if exercise.code %}
Expand All @@ -38,15 +38,16 @@ <h4 id="{{exercise.title|slugify}}">{{ exercise.icon}} {{ exercise.title }}</h4>
</div>
{% endif %}
</td>
<td width='600px' { text-align: left; }>
<td width='600px' text-left>
<!-- questions have lines OR options -->
{% if exercise.lines %}
{% for line in exercise.lines %}
{{ line }} <br>
{% endfor %}
{% endif %}

{% if exercise.options %}
{{ exercise.options }} <br>
{{ exercise.options | commonmark }}
{% endif %}
</td></tr>
</table>
Expand All @@ -65,7 +66,11 @@ <h4 id="{{exercise.title|slugify}}">{{ exercise.icon}} {{ exercise.title }}</h4>
{% endif %}
</td>
<td width='600px'>
{{ exercise.output|commonmark }}
{% if exercise.output %}
{% for line in exercise.output %}
{{ line }} <br>
{% endfor %}
{% endif %}
</td></tr>
</table>

Expand Down
12 changes: 7 additions & 5 deletions website/for_teachers.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,8 @@ def get_workbooks(self, level):
exercise['icon'] = '💻'
exercise['text'] = gettext('workbook_output_question_text')

# lines zou ik hier ook uit het antwoord kunnen uitrekenen!
exercise['lines'] = [line for x in range(exercise['lines'])]
a = len(exercise['answer'].split('\n'))
exercise['lines'] = [line for x in range(a)]

if exercise['type'] == 'circle':
exercise['title'] = gettext('workbook_circle_question_title')
Expand All @@ -115,16 +115,18 @@ def get_workbooks(self, level):
exercise['title'] = gettext('workbook_input_question_title')
exercise['icon'] = '🧑‍💻'
exercise['text'] = gettext('workbook_input_question_text')
a = len(exercise['answer'].split('\n'))
exercise['lines'] = [line for x in range(a)]

exercise['lines'] = [line for x in exercise['answer'].split('\n')]

exercise['output'] = [x for x in exercise['output'].split('\n')]

elif exercise['type'] == 'MC-code':
exercise['title'] = gettext('workbook_multiple_choice_question_title')
exercise['icon'] = '🤔'
exercise['text'] = gettext('workbook_multiple_choice_question_text')
# let op! op een dag willen we misschien wel ander soorten MC, dan moet
# deze tekst anders
exercise['options'] = '〇 ' + ' 〇 '.join(exercise['options'])
exercise['options'] = '〇 ' + '<br> 〇 '.join(exercise['options'])

elif exercise['type'] == 'define':
exercise['title'] = gettext('workbook_define_question_title') # ''
Expand Down

0 comments on commit 371c8f5

Please sign in to comment.