Page 48 - Touchcode_C7_Flipbook
P. 48
Step 7: From ‘Variables’ select variable ‘a’ three times.
Drag variable ‘a’ and drop them to ‘multiply’
block. Now, drag the multiplication block to ‘0’
of ‘set cube to 0’ block.
Step 8: From ‘Game’, select ‘splash’ block. Click on ‘Advanced’, select ‘Text’, and then
click on ‘join’ block. Drag the ‘join’ block and drop it to the ‘splash’ block.
Step 9: Write the message ‘Cube of a number is:’ in ‘hello’ and in ‘world’ drag the variable
‘Cube’, and drop it in a ‘join’ block.
Step 10: Drag the ‘splash’ block and drop it to the ‘on
start’ block, below the ‘set cube to’ block.
Step 11: Change the value of a to ‘2’, in ‘set a to 0’
block, and click on ‘Start the simulator’ to
see the output:
Step 12: Now, change the value of ‘a’ to 1-10, to get the cube of the number.
Well done, you have learned to find the cube of the number!
Experiential Learning
Coding Task 05
Sorting: Arranging the books
Sorting is the process of arranging data into meaningful order so that you can analyze it
more effectively.
In real-life scenarios, sorting can be seen in:
Telephone Directory: It stores the telephone numbers of people arranged by their
names in alphabetical order.
46 Touchcode-VII

