Skip to content

Commit

Permalink
adds level 8 in Dutch!
Browse files Browse the repository at this point in the history
  • Loading branch information
Felienne committed Oct 13, 2020
1 parent 9edaaca commit 834013c
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 38 deletions.
2 changes: 1 addition & 1 deletion coursedata/course/hedy/nl.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ course:
- level: "5"
- level: "6"
- level: "7"

- level: "8"
22 changes: 22 additions & 0 deletions coursedata/level-defaults/nl.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -137,4 +137,26 @@
explanation: "repeat en if samen"
example: "Bijvoorbeeld: if kleur is groen repeat 3 times print 'mooi!' else repeat 5 times print 'niet zo mooi'"
demo_code: "kleur is ask Wat is je lievelingskleur?\\nif kleur is groen\\n repeat 3 times\\n print 'mooi!'\\nelse\\n repeat 5 times\\n print 'niet zo mooi'"
8:
start_code: "for i in range 1 to 5\n print 'Hallo allemaal'\n print 'Dit wordt allemaal 5 keer herhaald'"
intro_text: |
ask en print werken nog zoals eerst, maar repeat is nu veranderd!
Je typt nu for i in range 1 tot 5, in plaats van repeat 5 times. Het leuke is dat je die variabele i ook in je programma kan gebruiken!
Je moet nog steeds alle regels die herhaald worden inspringen (dat betekent dat ze moeten beginnen met vier spaties)
commands:
-
name: "print"
explanation: "Iets letterlijk printen met print."
example: "Bijvoorbeeld: print '5 keer 5 is ' 5 * 5"
demo_code: "print '5 keer 5 is ' 5 * 5"
-
name: "if met meerdere regels"
explanation: "Het antwoord van een som vragen met ask en kijken of het goed is. Nu printen we twee regels uit."
example: "Bijvoorbeeld: antwoord is ask Hoeveel is 10 plus 10?"
demo_code: "antwoord is ask Hoeveel is 10 plus 10?\\nif antwoord is 20\\n print 'Goedzo!'\\n print 'Het antwoord was inderdaad ' antwoord\\nelse\\n print 'Foutje'\\n print 'Het antwoord moest zijn ' antwoord"
-
name: "repeat"
explanation: "nieuwe repeat"
example: "for i in range 1 to 11"
demo_code: "for i in range 1 to 11\\n print i\\nprint 'wie niet weg is is gezien'"
1 change: 0 additions & 1 deletion grammars/level8.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
start: _EOL* statement+

statement: if_statement elif_statement* else_statement?
| repeat
| ranged_loop
| assignment _EOL+
| print _EOL+
Expand Down
36 changes: 0 additions & 36 deletions tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -747,17 +747,6 @@ def test_builtin_functions(self):
a = input("string" + 1 + a + -1 + 2.8)
""")

def test_repeat(self):
result = hedy.transpile("""
repeat 5 * 2 times
a is a + 2
b is b + 2
""", 8)
self.assertEqual(result, """import random
for _ in range(5 * 2):
a = a + 2
b = b + 2
""")

def test_for_loop(self):
result = hedy.transpile("""
Expand Down Expand Up @@ -789,31 +778,6 @@ def test_if_elif_else(self):
x = 222
""")

def test_nesting(self):
result = hedy.transpile("""
repeat 2 times
for a in range 1 to 2
if a = 1
if a = 2
x is 2
else
x is 22
else
x is 222
""", 8)
self.assertEqual(result, """import random
for _ in range(2):
for a in range(1, 2):
if a == 1:
if a == 2:
x = 2
else:
x = 22
else:
x = 222
""")

class TestsLevel9(unittest.TestCase):
def test_list(self):
result = hedy.transpile("""
Expand Down

0 comments on commit 834013c

Please sign in to comment.