KTurtle/C3/Control-Execution/English-timed
From Script | Spoken-Tutorial
Revision as of 12:43, 25 February 2016 by Sandhya.np14 (Talk | contribs)
Time | Narration |
00:01 | Hello everybody. |
00:03 | Welcome to this tutorial on Control Execution in KTurtle. |
00:10 | In this tutorial, we will learn: |
00:13 | * 'while' loop and |
00:15 | * 'for' loop. |
00:17 | To record this tutorial, I am using:
|
00:32 | We assume that you have basic working knowledge of Kturtle. |
00:38 | If not, for relevant tutorials, please visit our website: |
00:45 | Let's open a new KTurtle Application. |
00:48 | Click on Dash home. |
00:50 | In the Search bar, type: "kturtle". |
00:53 | Click on the option. KTurtle Application opens. |
00:59 | Let me first explain about what is control execution. |
01:05 | Control execution is controlling the flow of a program. |
01:10 | Different conditions are used to control program execution. |
01:16 | Loop is a block of code, executed repeatedly till a certain condition is satisfied. |
01:25 | e.g. “while” loop and “for” loop. |
01:30 | Let's begin the tutorial with “while” loop. |
01:34 | In the “while” loop, the code inside the loop repeats till Boolean evaluates to "false". |
01:42 | Let me explain the structure of “while” loop:
while 'loop condition' { do something with loop increment variable } |
01:56 | I already have the code in a text-editor. |
01:59 | Let me copy the program from text editor and paste it into KTurtle editor. |
02:07 | Please pause the tutorial here and type the program into your KTurtle editor. |
02:13 | Resume the tutorial after typing the program. |
02:18 | Let me zoom into the program text, it may possibly be a little blurred. |
02:25 | Let me explain the code. |
02:27 | '#' hyash sign comments a line written after it. |
02:32 | It means, this line will not be executed while running the program. |
02:38 | reset command sets “Turtle” to its default position. |
02:43 | $x=0 initializes the value of variable 'x' to zero. |
02:52 | Message in a program is given within double quotes after the keyword "message". “message” command takes string as input. |
03:04 | It shows a pop-up dialog-box containing text from the string. |
03:11 | while $x<30 checks the “while” condition, |
03:17 | $x=$x+3 increments the value of variable $x by 3. |
03:27 | fontsize 15 sets the font-size used by print command. |
03:35 | fontsize takes number as input, set in pixels. |
03:42 | forward 20 commands Turtle to move 20 steps forward on the canvas. |
03:52 | print $x displays the value of variable 'x' on the canvas. |
04:01 | Let me click on the Run button to run the program. |
04:05 | A message dialog-box pops up. Let me click OK. |
04:11 | Multiples of 3, from 3 to 30, are displayed on the canvas. |
04:17 | Turtle moves 20 steps forward on the canvas. |
04:22 | Let's next work with “for” loop. |
04:26 | “for” loop is a counting loop. |
04:29 | Every time the code inside for loop is executed, |
04:34 | variable value is incremented till it reaches the end value. |
04:41 | Let me explain the structure of “for” loop. |
04:46 | for variable = start number to end number { Statement} |
04:55 | Let me clear the current program. |
04:59 | Let me type "clear" command and run to clean the canvas. |
05:05 | Let me copy the program from text-editor and paste it into KTurtle editor. |
05:14 | Please pause the tutorial here and type the program into your KTurtle editor. |
05:20 | Resume the tutorial after typing the program. |
05:25 | Let me zoom into the program text, it may possibly be a little blurred. |
05:32 | Let me explain the program. |
05:34 | '#' hyash sign comments a line written after it. |
05:39 | reset command sets Turtle to its default position. |
05:44 | $r=0 initializes the value of variable 'r' to zero. |
05:52 | for $x= 1 to 15 checks “for” condition from 1 to 15. |
06:01 | $r=$x*($x+1)/2 calculates the value of variable 'r'. |
06:12 | fontsize 18 sets the font-size used by print command. |
06:19 | print $r displays the value of variable 'r' on the canvas. |
06:26 | forward 15 commands Turtle to moves 15 steps forward on the canvas. |
06:34 | go 10,250 commands Turtle to go 10 pixels from left of canvas and 250 pixels from top of canvas. |
06:48 | “Turtle” displays all print commands without any time gap. |
06:54 | “Wait 2” command makes Turtle to wait for 2 seconds, before executing next command. |
07:04 | “print” command displays the string within double quotes and also displays variable '$r'. |
07:13 | Let me click on the Run button to run the program. |
07:17 | A series of sum of first 15 natural numbers and "Sum of first 15 natural numbers" are displayed on the canvas. |
07:27 | Turtle moves 15 steps forward on the canvas. |
07:32 | With this, we come to the end of this tutorial. |
07:37 | Let us summarize. |
07:40 | In this tutorial, we have learned to use |
07:44 | “while” loop and “for” loop. |
07:47 | As an assignment, I would like you to write programs to evaluate- |
07:54 | * Multiples of 2 using “while” loop. |
07:58 | * Multiplication table of a number using “for” loop. |
08:03 | Watch the video available at this URL: |
08:08 | It summarizes the Spoken Tutorial project. |
08:12 | If you do not have good bandwidth, you can download and watch it. |
08:17 | The Spoken Tutorial project team: |
08:20 | * Conducts workshops using spoken tutorials. |
08:23 | * Gives certificates to those who pass an online test. |
08:27 | For more details, please write to:
contact@spoken-tutorial.org |
08:36 | Spoken Tutorial project is a part of the Talk to a Teacher project. |
08:41 | It is supported by the National Mission on Education through ICT, MHRD, Government of India. |
08:48 | More information on this mission is available at this link: |
08:54 | This is Madhuri Ganpathi from IIT Bombay, signing off.
Thank you for joining. |