Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

📜 adds level workbook 7 & update layout #5929

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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: |-
## Repeat!
By the end of this lesson, you can:
* run a line of code multiple times
exercises:
- type: text
contents: |-
### Repetition
Sometimes you want to repeat a line of code multiple times, for example in a song or a story.
code: |-
repeat 5 times print 'Baby shark!'
- type: text
contents: |-
#### Exercise 1: Predict the output
What will be the output of these programs?
- 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 'Hi everybody!'
answer: |-
Hi everybody!
lines: 1
- type: output
code: |-
a is 4
repeat a times print 'Hi everybody'
answer: |-
Hi everybody!
Hi everybody!
Hi everybody!
Hi everybody!
lines: 4
- type: text
contents: |
### Exercise 2: Input
Take a look at the output. Write a program that could belong to this output.

Please note: Multiple answers can be correct. Choose whatever you want, as long as it's correct.
Fill up all the lines, so look carefully at the amount of lines!
- type: input
answer: |-
print 'Hi everybody!'
repeat 2 times print 'This is one line.'
output: |-
Hi everybody!
This is one line.
This is one line.
lines: 2
- type: input
answer: |-
print 'This is line 1'
print 'This is line 2'
print 'This is line 3'
output: |-
This is line 1
This is line 2
This is line 3
lines: 3
- type: text
contents: |-
### Exercise 3: Correct or Incorrect
Take a careful look at the programs and decide if they will trigger an errormessage or not.
- type : MC-code
options : ["Correct" , "Incorrect"]
code : |-
print 'The prince kept screaming for help'
repeat 3 times 'Help!'
answer : Incorrect, print is missing
- type : MC-code
options : ["Correct" , "Incorrect"]
code : |-
forward 100
repeat 3 times turn 90
answer : Correct
- type : MC-code
options : ["Correct" , "Incorrect"]
code : |-
people = mum, dad, Emma, Sophie
repeat 7 times print 'The dishes will be done by ' mensen
answer : Incorrect, at random is missing
- type : MC-code
options : ["Correct" , "Incorrect"]
code : |-
options = 1, 2, 3, 4, 5, 6
repeat 5 times print 'You threw: ' options at random
answer : Correct
- type: text
contents: |-
#### Exercise 6: Programming words
We have learned a new programming word again! Explain in your own words.
- type: define
word: "repeat"
answer: "repeating a line multiple times"
lines: 1
- type: text
contents: |-
#### What did you think?
- type : question
text : "Which exercise did you like best this level?"
lines : 1
- type : question
text : "What did you like about it?"
lines : 5
- type : question
text : "Which exercise did you like least this level?"
lines : 1
- type : question
text : "What didn't you like about it?"
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 uitvoeren
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: define
word: "repeat"
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
Loading