0% found this document useful (0 votes)
35 views31 pages

Codementum

The document provides an overview of a coding lesson on the Codementum platform, focusing on basic coding concepts such as algorithms, commands, loops, variables, and arrays. Users will learn to develop computational thinking skills and complete tasks using specific commands. The training is structured to gradually increase in difficulty, ensuring a smooth learning transition for students.

Uploaded by

panda
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
35 views31 pages

Codementum

The document provides an overview of a coding lesson on the Codementum platform, focusing on basic coding concepts such as algorithms, commands, loops, variables, and arrays. Users will learn to develop computational thinking skills and complete tasks using specific commands. The training is structured to gradually increase in difficulty, ensuring a smooth learning transition for students.

Uploaded by

panda
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 31

Subject: The Basics

Block Explanation
Overview
In our first lesson, our users will make entrance to the world of coding with It is used for pushing our character forward. It moves
Codementum platform. Since it is our first lesson on the platform, we will firstly according to the value written inside.
help them develop their knowledge and skills set at the basic level by mentioning
Button Sample usage:
the logic of setting up an algorithm when coding. When the first 10 tasks which we
forward(5)
formed for this purpose are completed, our users will have learnt to set up
//it pushes our character 5 squares forward.
algorithms and will be able to code for them.
Our training consists of contents that are suitable for student levels which
go from easy to difficult. Difficulty level increases in each new stage through
smooth transitions. In this first lesson of training to code which is a unique part of Block Explanation
captivating the computer world, we will start to take first steps to solve the issues
we encounter in daily life by thinking like a computer. It is used to turn our character within the stage.
Thanks to this command our character can turn right,
The Objective of the Subject and Learning Outcomes left or backwards.
At the end of this lesson, our users: Button
Sample usage:
● Will gain computational thinking skills.
turn(right), turn(left), turn(back) etc.
● Will learn the logic of setting up algorithms and the usage of the developed
will in Codementum platform.
● Will discover coding and computer programming.
● Will learn the usage of the Codementum platform. Block Explanation
● Will complete 10 scenes from the Codementum platform.
It is the command which pushes our character one
Commands to be Used
step up and one step forward from the scene. Using
forward(), turn(), forwardUp(), forwardDown(), beaver.forward() this command our characters can reach the targets
which take place in one upper stage of our task scene.
Blocks and Button icons to be used for training about this subject Button
Block: You can create code by dragging and dropping the related blocks. Sample usage:
Buttons: Buttons will be seen on the screen during the coding adventures and forwardUp()
when you click, it will write the related code on the screen automatically.
Explanation: You can find the basic knowledge you need in the explanation section.
codementum.com
Block Explanation Block Explanation

It is the command which pushes our character one


step down and one step forward from the scene. With The Codementum platform is basically designed for
this command our characters can reach the targets our students to code . Therefore the blocks of the
which take place in one-down stage of our task scene. character in the scene are not ready and it is formed
Button automatically in the mode of blocks when the
character on the scene is clicked.
Sample usage: Image
forwardDown()
As in the example of beaver which is a supporting
character, when you click on any beaver character on
the scene, beaver block will be formed automatically.
Supporting character usage
Our lovely character beaver will help our main character to complete its This procedure is also valid for the supporting
task by passing through watery fields. In order to give our assistant characters characters of turtle and seal which we will encounter
command, it is enough for you to click on the beaver character on the screen. in the forthcoming scenes.

WARNING 2
We do not need to write for example, monkeys. forward() in the commands we
write for moving our main character. It is enough to write forward() for the main
WARNING 1 character. The commands given without using point (.) is for our main character
In this section we want to set up an algorithm for scene solutions in the mode of which takes place in the scene for completing the tasks. However, when there are
block, if we click on the beaver character, beaver block will be formed more than one character in the scene, we need to specify the ones other than our
automatically. If we click on coding mode “beaver” will be written inside the coding main character as we do here (by using point. For example: we must specify
section. This procedure is also valid for the supporting characters of turtle and seal “turtle.forward()” in particular.
which we will encounter in the forthcoming scenes.

codementum.com
Sample Solution: Scene 3

Algorithm Block Python Javascript

 Start forward(4) forward(4)


 Move 4 squares forward turn(right) turn(right)
 Turn right forward(6) forward(6)
 Move 6 squares forward

Sample Solution: Scene 8

Algorithm Block Python Javascript

 Start beaver.forward(3) beaver.forward(3)


 Beaver move 3 squares forward forward(9) forward(9)
 Turn right
 Panda move 9 squares forward

codementum.com
Blocks and Button icons to be used in the training about this subject
Subject: Repeat Loops
Block: You will be able to make block coding by dragging and dropping the related
Overview blocks.
In our new lesson, we will explain to our users how to write Button: Buttons will be seen on the screen during coding adventures and when you
repeating commands briefly and to the point. Well comprehension of this click, it will write the related code on the screen automatically.
subject will form the base of many subjects which we will learn in the future. Explanation: You can find the basic knowledge you need in the explanation section.
In this lesson, your students will learn both new commands and how to use
Block Explanation
our commands within repeat.
Thanks to the repeat loop, instead of writing our
During the explanation of the subject you can also find a sample from your repeating processes more than once, it is enough to
own life in order to understand the intended purpose of the repeat expressions in write it within the loop and specify the repeat number
the most effective way. Ensure the concepts become more understandable by we want. Thus the number of our command lines
decreases and we can reach the most efficient and
giving examples from daily life. Our activity below will form an example for this.
correct commands, according to three star
Button application.
Activity
What do we do respectively when we get up in the morning? (such as I got up – I Sample usage:
had breakfast-- I came to school) repeat 3:
forward(5)
“What would you do if I asked you to perform this process for 5 days in weekdays?”. turn(left)
While we complete our task, we will use a new command for our repeating
expressions in order to specify the situations repeating by the number we provide.
Thus we will have written the processes we must perform once, but since they are BLOCK
included in our repeat command, they will repeat by the number we provide. Usage Explanation
Instead of writing our repeating expressions in the same way more than once, we Number of iterations
need to indicate it with repeat a: command in the Codementum platform. If we
need to form a sample for this activity, it will be as;
Repeat block
repeat 5:
getting up-having breakfast-coming to school
Repeating commands
Commands to be Used
repeat a:,forward(), turn(), forwardUp(), forwardDown(), beaver.forward()

codementum.com
PYTHON JAVASCRIPT
Usage Explanation Usage Explanation

Number of iterations
Number of iterations
Repeat block
Repeat block

Repeating commands
Repeating commands

Erroneous writing forms


Erroneous writing forms
Python

JavaScript

Why is it wrong? Why is it wrong? Correct form:


You should write the Number of repeats Our code is correct due to
commands which you should be written paying attention to
want to repeat within following spacing after spacing between
“Repeat” after indenting “Repeat” command and it expressions and the
with the tab key. should be used with a indenting, which should
colon “:” be done with the tab key
for the commands
written within Repeat.

codementum.com
Sample Solution: (Without using repeat) Scene 13

Algorithm Block Python Javascript

 Start forward(2) forward(2)


 Move 2 squares forward forwardUp() forwardUp()
 Move up forwardDown() forwardDown()
 Move down forward(1) forward(1)
 Move 1 square forward forward(2) forward(2)
 Move 2 squares forward forwardUp() forwardUp()
 Move up forwardDown() forwardDown()
 Move down forward(1) forward(1)
 Move 1 square forward

Sample Solution: (By using repeat) Scene 13

Algorithm Block Python Javascript

 Start repeat 2: repeat 2:


 2 times within repeat forward(2) forward(2)
 Move 2 squares forward forwardUp() forwardUp()
 Move up forwardDown() forwardDown()
 Move down forward(1) forward(1)
 Move 1 square forward

codementum.com
these variables.In other words; we put the numbers into the boxes. And when we
Subject: Variables want them we recalled these numbers and used them.
Overview
Commands to be Used
Variables are boxes which save the data we enter for us. By declaring a
variable we form a box for ourselves, then when we need it, we can recall the data The variables they will use in order to complete the tasks and their usage forms.
from the box and use it. We can use the data in the boxes we formed when we
need it by recalling them again and again. Blocks and Button icons to be used in the training about this subject

In order to perform an action the first thing to be done is to store that data.
When we want to perform an action we recall the data from the storage and Block Explanation
perform the required actions. In the programming languages, we use the variables The name of the variables may be letters such as a,b,c
in order to express the data in the storage. To sum up; they are the declarations or words in a similar way. The important thing is to
that we make for storing the data processed in the programming language inside use the name which we use to indicate the variable in
the storage of the computer. the beginning in the same way when we recall it.

Activity
Sample usage (Python):
Suppose that we have two numbers and we add these two numbers and Button a=5
say the result. The action that we must perform will be formed from the steps forward(a)
similar to the ones below.
Sample usage (Javascript):
 say a number (3) var a = 5
 say another number (5) forward(a)
 add these two numbers (3+5)
 say the result (8)
BLOCK
 3+5=8
When a number is said, we stored that number to a part of our memory. Usage Explanation
And when the second number is said we also recorded it to another part of our
Variable name
memory. In the next stage we added the two numbers using the addition method
that we had learnt before.
At the end we recorded these values that we added to another part of our
memory. Then we said this result we stored aloud.
Consider that the numbers that will be added for this action change
continuously. Now here at this point variable declaration gets involved. As in the Value given to the variable
example above, we declared two different variables and stored the numbers in

codementum.com
PYTHON Usage Variable
Usage Explanation
Variable name

Variable name Value given to the variable

Value given to the variable Variable declaration Variable name


Variable declaration değer

Usage of variable

Usage of Variable

Erraneous writing forms

Erraneous writing forms


JavaScript

Python

Why is it wrong? Why is it wrong? Correct form:


Formed variable is It is required to be used It is correct due to the
missing because it is not with an equal sign in the declared variable used
being used within any form of “a=3” while the with the equal sign in the
expression. variable is formed and form of “forward(a)”.
value is transferred.

JAVASCRIPT

codementum.com
Sample Solution: Scene 23

Algorithm Block Python Javascript

 Start a=5 var a = 5


 declare variable a repeat 3: repeat(3){
 give variable a value 5 forward(a) forward(a)
 3 times witihin Repeat turn(right) turn(right)
 move "a" square forward }
 Turn right

codementum.com
Now let's continue to our document for better understanding of our subject.
Subject: Arrays
Commands to be Used
Overview
Commands which are used with the array in the form of turtle[1].forward() and the
In our new lesson, our users will learn arrays with the ability to keep
commands which has been learned before.
multiple variables within them. Intended purpose of the arrays is that they have the
feature of keeping multiple variables at the same time within them. When we say Blocks and Button icons to be used in the training about this subject
multiple numbers it can also be big values such as 100 or 1000. Instead of declaring
a large number of variables with the same name one by one, we can keep them
together by means of arrays.
Block Explanation
When we have one variable, array and variables may be considered as the
same thing, but we shouldn't use variables instead of arrays for multiple variables. Arrays which can keep multiple variables
within them enable us to assign
Activity separate tasks for each of our characters
Let's start to understand arrays by giving an example of the fruits after in case there are multiple characters
having the same name in our task
shopping from the market. Suppose that we bought 5 different fruits. Apple,
scenes. We can transfer our characters
Banana, Orange, Apricot and Peach. Let's call all of these "Fruits". We transferred Text into an array with their common names
multiple values into the “Volunteers” variable distinctly from variable samples we and recall our characters according to
made in our previous lesson. Because of keeping multiple variables within it, the numbers we gave.
"Volunteers" became an array. Items within this array have different values but
have a common name. Now let's give some commands respectively to the items of Sample usage (Python):
myTurtles = [turtle0,turtle1]
the array that we formed for you to comprehend this better.
myTurtles [0].forward(3)



First item of the “Fruits" array is “Apple”
Second item of the “Fruits" array is “Banana”
Third item of the “Fruits" array is “Orange”
[] myTurtles [1].forward(3)
forward(5)

Sample usage (Javascript):


 Fourth item of the “Fruits" array is “Apricot”
var myTurtles = [turtle0,turtle1]
 Fifth item of the “Fruits" array is “Peach” myTurtles [0].forward(3)
myTurtles [1].forward(3)
In this manner, we can differentiate the variables belonging to the same forward(5)
type thanks to the naming we use. By virtue of the array we use, we could keep
multiple variables of a type together and assign them different values.
WARNING
We can do this activity by coding as below.
The numbering of arrays starts with 0 (zero). It means the number of the first
Fruits = [Apple, Banana, Orange, Apricot, Peach] variable is 0, the number of the second variable is 1.

codementum.com
BLOCK Erraneous writing forms
Usage Explanation

Common name of variables in array Python

1.The order of the variable

2.The order of the variable


Why is it wrong? Why is it wrong? Correct form:
Array definition In order to recall the When we want to assign Our command is correct,
3.The order of the variable items in the arrays, we our characters special because our numbers to
must write their tasks we must put a point reach array items are
1. order of the variable numbers inside square between them while within square brackets and
brackets. writing the tasks with point is used after
“[]” (Alt Gr 8-9) their names. character names when task
is written.
PYTHON
Usage Explanation
JAVASCRIPT
Array definition
Usage Explanation
The order of the variable in the array
değer Array definition

The order of the variable in the array


değer

codementum.com
Erraneous writing forms

JavaScript

Sample Solution: Scene 33

Algorithm Block Python Javascript

 Start myTurtles = [turtle0,turtle1,turtle2,turtle3] var myTurtles = [turtle0,turtle1,turtle2,turtle3]


 define the array with the name myTurtles[0].forward(3) myTurtles[0].forward(3)
“myTurtles” myTurtles[1].forward(3) myTurtles[1].forward(3)
myTurtles[2].forward(2) myTurtles[2].forward(2)
 assign the variables to “myTurtles”
myTurtles[3].forward(2) myTurtles[3].forward(2)
array [turtle0, turtle1, turtle2, forward(7) forward(7)
turtle3]
 First [0] turtle move 3 squares
forward
 Second[1] turtle move 3 squares
forward
 Third [2] turtle move 3 squares
forward
 Forth [3] turtle move 3 squares
forward
 Main character move 7 squares
forward

codementum.com
Thus we can reach a solution within seconds just by writing a short piece of code.
Subject: For Loops Now let's continue to our document for a better understanding of our subject.
Overview Commands to be Used
One of the most basic structures of programming is loops. We can execute for loop which will be used for our character to complete repetitive tasks and the
the repeating actions more systematically by using loops. Loops also enable us to commands which were learnt before.
create less code.
Blocks and Button icons to be used in the training about this subject
In this lesson, your students will learn the “For Loop” which they must use
for completing the repetitive actions in the short way for our task scenes. "For"
allows us to repeat the actions we write within the loop by the offset value Block Explanation
entered. This enables us to complete the task in a short way by writing every step We can easily write repetitive actions which we
once within the loop instead of writing every step one by one in our tasks that are need to write for completing our tasks thanks to
repeated multiple times. for loop, which allows us to specify the actions we
want to repeat and how many times we want
In our lesson, we will show your students the writing form of "For Loop"
them to repeat. The commands we write within for
which has a similar usage with “repeat n:” command we learnt in our previous loop repeat by the number we specified as the
lessons. This means they can solve our tasks belonging to our lesson efficiently. Button interval.
We generally use for loop in situations where we know the number of
Sample usage (Python):
loops. In for loop, we can also define start, finish and increase/decrease values of
for a in range(2):
our counter in our loop. forward(1)
turn(left)
Activity
forward(1)
In our activity you want to write the numbers from 1 to 1000 on the screen. turn(right)
How would you do that?
Sample usage (Javascript):
Would you continue by writing all numbers till 1000 one by one? Let's
for(var a=0;a<2;a++){
suppose that you continued like that. You wrote all the 1000 numbers on the forward(1)
screen one by one and probably spent most of your time on this action. turn(left)
Or would you like to write it at once by writing an efficient code as below? forward(1)
turn(right)
for a in range(1000) }
print(a)
a=a+1

codementum.com
BLOCK Erronous writing forms
Usage Explanation
Python
Variable
Number of iterations

Repeating Why is it wrong? Why is it wrong? Correct form:


commands
You should write the We must space Our code is correct due to
commands you want between the paying attention to
to repeat within for expressions we write spacing, which we need to
loop after indenting within loop. Such as leave between expressions
with tab key. “For a” and“in and to the indenting which
range”. is required to be done with
the tab key.
PYTHON
Usage Explanation
JAVASCRIPT
Variable Number of iterations Usage Explanation
Variable

Number of iterations

Repeating
commands
Repeating
commands
mber of
iterationsNu
mber of
iterations
Number of codementum.com
iterationsNu
mber of
Erronous writing forms

WARNING
JavaScript It is important to differentiate the names of initial variables, "for" will be used in
situations where we want our characters to move according to the loop by using
nested "for" ensuring correct execution of the task solution. As in the example
above, in nested for loop, since the first loop will run 3 times, and the loop within it
will run 5 times, the loop within it will work 15 (3x5=15) times. Otherwise, if we use
the same variable name within the two loops, it would run 5 times instead of 15 in
total. To set an example:
Erronous writing forms

Usage of Nested For Loop


Block Python Javascript
As you see below we have two repetitive tasks. Two nested for loops can be used
for solution in this case and in such cases. It is important to differentiate variable
names, which we will give as initial value while writing our nested loops for
ensuring correct execution of the task solution.

Nested For Loop


Block Explanation
Sample usage (Python):

WARNING
Sample usage (Javascript): Normally if two identical variable names were not used, our command block would
run 15 times in total, but because here "a '' is used for both loops, it will just run 5
times. So we should write different variable names in nested for to avoid such
situations.

codementum.com
Sample Solution: Scene 43

Algorithm Block Python Javascript

 Start for a in range(2): for(var a=0;a<2;a++){


 2 times within For loop forward(3) forward(2)
 Move up forwardUp() turn(left)
 Move down forwardDown() forward(2)
 Move 1 square forward forward(1) turn(right)
}

codementum.com
Subject: Helper Methods
Blocks and Button icons to be used in the training about this subject
Overview
There are some helper methods which we can use while making our
Block Explanation
solutions in the Codementum platform. In our new lesson we will learn wait()
İt is our command which allows our characters to wait
which is one of our helper methods. In the Codementum platform for the solution in seconds during the written pe. This command is the
of some of our tasks, you are required to avoid enemy characters and wait for them command which ensures our main character waits for
to sleep. They can write the waiting period which is required to be written for this the period required so that the enemy character in our
purpose in seconds using our wait() command. We will show the intended purpose scenes is asleep.
and usage forms of our command throughout our lesson.
Button
Activity Sample usage (Python):
wait(3)
We can compare the usage of wait() in this subject to waiting in traffic forward(5)
lights. Just as we wait in red light and pass when green, we wait for the enemy
characters to sleep or take another action to reach the energy capsules on our Sample usage (Javascript):
platform. wait(3)
forward(5)
There are also enemy characters whom our main characters are afraid of in
our Codementum platform. For example there are lion or bear characters
preventing our main character from reaching the energy capsules which we will see BLOCK
in task scenes belonging to this subject. Our main character must wait for these Usage Explanation
characters (bear or lion) to sleep with the wait () command before reaching the
target. (Our applications do not involve violence, this action of being afraid is totally
Waiting period (sec)
mise en scene.)

Commands to be Used

wait() command which will be used to wait for the enemy character to sleep and
the commands which were learnt before.

codementum.com
PYTHON
Usage Explanation JAVASCRIPT
Usage Explanation

Waiting period (sec)

Waiting period (sec)

Erroneous writing forms

Python

Why is it wrong? Why is it wrong ? Correct form:


The period parameter Wait command is Our code is correct
which is required to be required to be used with because period is
written for our wait a period parameter. Our specified with wait
command should be code is wrong because command and the period
written between how long our character parameter is between
parentheses. Our code is will wait is not specified. parentheses.
wrong because the
parentheses are not
used.

codementum.com
Sample Solution: Scene 58

Algorithm Block Python Javascript

 Start forward(5) forward(5)


 Move 5 squares forward turn(right) turn(right)
 Start over wait(5) wait(5)
 Wait 5 seconds forward(7) forward(7)
 Move 7 squares forward

codementum.com
Blocks and Button icons to be used in the training about this subject
Subject: Conditional Expressions - if
Overview Block Explanation
In our new lesson our users will learn conditional expressions which they It is the command which is used to make our
need to use for completing our tasks. Using conditional expressions, a result is characters choose between two options. In
reached by making an assessment between two or more choices. As you know, we other words; we use it to execute the action
need to specify every action that will be taken by our characters in the which meets the condition (or not to execute
the action which doesn't meet the
Codementum platform. In this lesson it will be emphasised that our characters
condition). Thanks to this command our
don't have the ability to think on their own and decide. characters can make the correct choices for
Button
The basic logic of conditional expressions subject is to enable our completing their tasks. Just like our main
characters to choose between at least two choices for completing their tasks. character which completes its tasks by
Activity choosing the green capsules between green
and black, which we will use for this lesson.
The examples for conditional expressions from daily life are as below. As
seen in the examples there is a contingent result.
Sample usage (Python):
▪ I will buy a bicycle for you if you pass the class. capsules=[capsule1, capsule2]
▪ Eat the fruits if they are clean. for a in range(2):
forward(4)
▪ You can get out of the class when the bell rings. open()
if capsules[a].green:
We will use if conditional expression for allowing our characters to choose forward(1)
between two choices. Thus our characters will move according to the conditions we
wrote. For example, our main character wants to collect energy capsules in our task Sample usage (Javascript):
scenes belonging to our lesson, but unlike our previous lessons there are harmful var capsules=[capsule1, capsule2]
capsules. In this case, our character needs to control the capsules and take action for(var a=0;a<2;a++){
forward(4)
according to the appropriate one of the two options (useful/harmful). In order to
open()
make our main character choose correctly, we will use "if" statements which is one if(capsules[a].green){
of our conditional expressions in our lesson. forward(1)
}
Commands to be Used }
The command which our character will use
If command which they will use for completing the tasks and the commands which for opening the cubes.
were learnt previously.
codementum.com
BLOCK Why is it wrong? Why is it wrong? Correct form:
Usage Explanation If the condition is true When writing conditional Our code is correct as a
Conditional within if expression, we expression with if, result of paying attention
should write the spacing should be made to the spacings which
expression
commands which will be between our words. should be made between
executed after indenting the expressions and the
with tab key. indenting which should
Conditional Commands to run when be done with the tab key
expressionCon the condition is met after our conditional
ditional expression.
expression

JAVASCRIPT
PYTHON Usage Explanation
Usage Explanation Conditional
expression
Conditional
expression

Commands to run when


Commands to run when the condition is met
the condition is met expression
expression
Conditional expression
Conditional expression Erroneous writing forms
Erroneous writing forms
JavaScript
Python

codementum.com
Sample Solution: Scene 68
Algorithm Block Python Javascript

 Start capsules=[capsule1, capsule2] var capsules=[capsule1, capsule2]


 Identify the capsules within array for a in range(2): for(var a=0;a<2;a++){
 2 times within for loop forward(4) forward(4)
 move 4 squares forward open() open()
 Open the cube if capsules[a].green: if(capsules[a].green){
 If the capsule is green forward(1) forward(1)
move 1 square forward }
}

Sample Solution: Scene 77


Algorithm Block Python Javascript

 Start lions=[lion1, lion2] var lions=[lion1, lion2]


 Identify lions within the "lions" for lion in lions: for(var lion of lions){
array wait(3) wait(3)
 As many as the number of "lion" in if lion.sleeping: if(lion.sleeping){
the for loop forward(4) forward(4)
 wait 3 seconds open() }
 lion is sleeping if capsule.green: }
 Move forward 4 squares forward(1) open()
 open cube if(capsule.green){
 If the capsule is green, advance 1 forward(1)
frame }

codementum.com
Commands to be Used
Subject: Conditional Expressions – if elif
if elif command which they will use to complete the tasks and the commands which
Overview were learnt previously.
In our previous lesson we learnt about conditional expressions we just used
only "if" expressions in order to specify a conditional situation. In this lesson we will Blocks and Button icons to be used in the training about this subject
show a new command which can be used with "if" when forming conditional
expressions. By means of "If Elif" commands conditional expressions can be formed
for multiple options. Learning the differences between if and if elif usage will Block Explanation
facilitate the usage of the commands in the task scenes.
It is the command which enables the writing of
multiple choice, using this command we can identify
Activity multiple conditional expressions together and we can
In this activity suppose that you are a teacher and you are telling your write the actions to be executed according to the
students what they should do according to the marks they got. choices of our character. For example in our task
Indicate that your student takes 70-80-90 points respectively on a basis of scenes from our first lesson while we can enable our
100 points after an exam. Then write a few tasks on the board which should be racoon character to differentiate the meats it has to
completed when your student is waiting. You will condition the task expressions Button collect as fresh -stale, we can also enable our Racoon
you wrote and enable your student to take action according to the points s/he got. character which is in the same scene to get the stale
breads.
● If you got 100 sit down.
● If you got 90 write “I got ninety on the board”. Sample usage (Python):
● If you got 80 write “I got eighty on the board”. forward(2)
● If you got 70 write “I got seventy on the board”. open()
if capsule.green:
After writing the rules your student should follow on the board, specify the forward(1)
marks respectively as "You got 90 from the exam" "You got 80 from the exam" "You elif capsule.red:
got 70 from the exam" After declaring each point, specify that your student should monkey.forward(2)
take action according to the instructions written on the board. Then add our "if elif"
commands to the beginning of these instructions in accordance with our topics. Sample usage (Javascript):
forward(2)
● If you got 100 sit down. open()
● elif you got 90 write “I got ninety on the board”. if(capsule.green){
● elif you got 80 write “I got eighty on the board”. forward(1)
● elif you got 70, write “I got seventy on the board”. } else if(capsule.red){
monkey.forward(2)
}

codementum.com
BLOCK
Usage Explanation
Why is it wrong ? Why is it wrong? Correct form:
If the condition is true When writing conditional Our code is correct due to
1. Conditional within if Elif expression, we expression with if Elif, paying attention to the
expression should write the commands spacing should be made spacings which should be
2. which will be executed after between our words. made between the
indenting with tab key. expressions and the
indenting, which should
2. Conditional be done with tab key after
expression our conditional
expression.
3.

JAVASCRIPT
PYTHON
Usage Explanation
Usage Explanation

1.Conditional expression

1.Conditional expression 2.Conditional expression

2.Conditional expression

Erroneous writing forms

JavaScript
Erroneous writing forms

Python

codementum.com
Sample solution: Scene 83

Algorithm Block Python Javascript

 Start capsules=[capsule1, capsule2] var capsules=[capsule1, capsule2]


 Define the capsules within the monkey.forward(3) monkey.forward(3)
array for a in range(2): for(var a=0;a<2;a++){
 Monkey move 3 squares forward forward(1) forward(1)
 2 times within For loop open() open()
 Move 1 square forward if capsules[a].green: if(capsules[a].green){
 Open the cube forward(1) forward(1)
 If the capsule is green monkey.forward(2) monkey.forward(2)
i. Move 1 square elif capsules[a].red: } else if(capsules[a].red){
forward monkey.forward(2) monkey.forward(2)
ii. Monkey move 2 forward(1) forward(1)
squares forward }
 If the capsule is red }
i. Monkey move 2
squares forward
ii. Move 1 square
forward

codementum.com
Commands to be Used
Subject: Conditional Expressions – if else
If else commands which they will use for completing the tasks and the commands
Overview which were learnt previously.
We will allow them to learn the last form of conditional expressions in our Blocks and Button icons to be used in the training about this subject
lesson. We will show them that they can also write conditions with "if else" Block Explanation
expression among the options while their characters complete the tasks by means
of "if else" commands as the last one after the subjects of "if" - "if elif" In order to enable our characters to make choices
between options in our task scenes "if" conditional
expressions are used. Thanks to ‘if else’ structure
Activity
we don't need to write the required actions one by
In this activity we specify school days and holidays according to days of the week. one for each situation when conditional expression
for multiple choices is determined. "Else"
● Monday- School day expression which will be valid for every option
● Tuesday - School day except the option which is next to the conditional
● Wednesday - School day Button expression determined with "if '' can be specified.
● Thursday - School day
● Friday - School day Sample usage (Python):
● Saturday- Holiday ☺ forward(2)
● Sunday - Holiday ☺ open()
if capsule.green:
We arrange the sentences according to if else commands which you will write forward(2)
according to the sentences you wrote. else:
jump()
if day= saturday and sunday
Holiday Sample usage (Javascript):
else forward(2)
School day open()
if(capsule.green){
As you can see we have an example with seven choices. But here instead of forward(2)
writing a different condition for each day, after identifying a condition with ‘if’ we } else {
collect all the remaining options within the ‘else’ expression. Unlike the if elif jump()
structure we learnt in our previous lesson, we do not need to write the results for }
all options we have one by one. Continuing from our activity for example, by
The command with which our character will pass
identifying Saturday and Sunday, we specified that if one of these two days is said,
to the other square by jumping.
the answerback should be holiday, and for all five days except these two days, the
For example; its passing to the next square by
answerback should be weekday.
jumping over the harmful capsule (black) in order
to continue its way.

codementum.com
BLOCK Why is it wrong? Why is it wrong? Correct form:
Usage Explanation If the condition is true When writing conditional Our code is correct because
within if else expression, we expression with if else, attention is paid to the
should write the commands spacing should be made spacings which should be
which will be executed after between our words. made between the
indenting with the tab key. expressions and the
1. Conditional
indenting which should be
expression done with the tab key after
2. our conditional expression.

else 2. Conditional
expression JAVASCRIPT
Usage Explanation

PYTHON
Usage Explanation 1. Conditional expression

else 2. Conditional expression

1. Conditional expression

else 2. Conditional expression Erroneous writing forms

JavaScript
Erroneous writing forms

Python

codementum.com
Sample solution: Scene 93

Algorithm Block Python Javascript

 Start capsules=[capsule1,capsule2,capsule3] var capsules=[capsule1,capsule2,capsule3]


 Define the capsules within the forward(1) forward(1)
array for c in capsules: for(var c of capsules){
 Move 1 square forward open() open()
 Within For loop in the amount of if c.green: if(c.green){
the capsules forward(2) forward(2)
 Open the cube else: } else {
 If the capsule is green jump() jump()
move 2 squares forward }
 If else jump 1 square }
forward

codementum.com
They are the values which are used to indicate the
Subject: Boolean Logic situations when our characters have two options true
or false in the Codementum platform. It can take
Overview “True” or “False” values according to the results of the
In our new lesson, we will learn about boolean values which take the values comparison process. It is the equivalent of 0 and 1
of “True” and “False”. Firstly we will specify how boolean expressions are used and values in computer science.
what their intended purposes are.
In computer science if the actions are true it is called as 1, and if it is false It is stated as;
as 0. So the boolean values that we will learn are 0 and 1 in computer science. If a situation is occurring == 1
Boolean values enables the actions to be done according to the results of the If a situation is not occurring == 0
comparison expressions we wrote being true of false, it originates from the
surname of English mathematician George Boole True
Sample usage (Python):
Activity
False forward(3)
Turn on and turn off the light by using the switch in your house or open()
classroom. 0 and 1 here represent the expression being “True” or “False”. if capsule.red == True:
As you see when you turn off the switch there is no light and when we turn forward(1)
it on there is light. If we put this situation into coding, it is stated as "there is light
== True" and "there is no light == False". As you know while writing conditional Sample usage (Javascript):
expressions with if, the actions were executed by deciding as "if it is true" or "if it is forward(3)
not true". While these conditional expressions are written, support can be received open()
from Boolean values when deemed necessary. Boolean values are mostly used with if(capsule.red == true){
if conditional expressions. forward(1)
}
Commands to be Used
True, False and if commands which they will use to complete the tasks and
commands which were learnt previously. BLOCK
Usage Explanation
Blocks and Button icons to be used in the training about this subject
Comparison
Boolean values Explanation

Conditional expression
Commands to run when
the condition is met

codementum.com
PYTHON
Usage Explanation JAVASCRIPT
Usage Explanation
Comparison
Comparison

Commands to run when


the condition is met Commands to run when
the condition is met

Erroneous writing forms


Erroneous writing forms
Python
JavaScript

Why is it wrong? Why is it wrong? Correct form:


It is wrong due to the usage When writing comparison Our code is correct because
of one equal sign. In order operations using Boolean attention is paid to spacing
for Boolean values to work values, spacing must be between expressions and
correctly, "==" should be made between our words. writing two equal signs side
used while making the by side.
comparison process.

codementum.com
Sample Solution: Scene 103

Algorithm Block Python Javascript

 Start capsules=[ var capsules=[


 declare the array named “capsules” capsule1,capsule2,capsule3,capsule4 capsule1,capsule2,capsule3,capsule4
 assign the variables to “capsules” ] ]
array [capsule1, capsule2, forward(2) forward(2)
capsule3, capsule4] for c in capsules: for(var c of capsules){
 Move two squares forward open() open()
 In the number of the variables in if c.red == True: if(c.red == true){
the array within for loop forward(1) forward(1)
 Open cube }
 If the capsule is red move }
one square forward

Sample Solution: Scene 106

Algorithm Block Python Javascript

 Start wait(5) wait(5)


 Wait for 5 seconds if bear.sleeping == True: if(bear.sleeping == true){
 If the bear is sleeping forward(7) forward(7)
(bear.sleeping == True) }
 move 7 squares forward

codementum.com

You might also like