Difference between revisions of "KTurtle/C3/Control-Execution/English-timed"

From Script | Spoken-Tutorial
Jump to: navigation, search
Line 4: Line 4:
 
|-
 
|-
 
|00:01
 
|00:01
||Hello Everybody.
+
||Hello everybody.
  
 
|-
 
|-
Line 11: Line 11:
 
|-
 
|-
 
||00:10
 
||00:10
||In this tutorial, we will learn  
+
||In this tutorial, we will learn:
  
 
|-
 
|-
 
|00:13
 
|00:13
||* ''''while'''' loop  and
+
||* 'while' loop  and
  
 
|-
 
|-
 
|00:15
 
|00:15
||* ''''for'''' loop.
+
||* 'for' loop.
 
|-
 
|-
 
|| 00:17
 
|| 00:17
Line 35: Line 35:
 
|-
 
|-
 
||00:45
 
||00:45
||Let's open a new '''KTurtle''' '''Application'''.
+
||Let's open a new '''KTurtle Application'''.
  
 
|-
 
|-
 
|00:48
 
|00:48
||Click on '''Dash  home'''.  
+
||Click on '''Dash  home'''.  
  
 
|-
 
|-
 
|00:50
 
|00:50
||In the '''Search bar''', type: "KTurtle".
+
||In the '''Search bar''', type: "kturtle".
  
 
|-
 
|-
Line 54: Line 54:
 
||01:05
 
||01:05
  
||'Control execution' is controlling the flow of a program.  
+
||'''Control execution''' is controlling the flow of a program.  
  
 
|-
 
|-
Line 61: Line 61:
 
|-
 
|-
 
||01:16
 
||01:16
||'''Loop''' is a block of code  executed repeatedly till a certain '''condition''' is satisfied.
+
||'''Loop''' is a '''block''' of code, executed repeatedly till a certain '''condition''' is satisfied.
 
|-
 
|-
 
|01:25
 
|01:25
||E.g. '''“while”''' loop and  '''“for”''' loop.
+
||e.g. “while” loop and  “for” loop.
 
|-
 
|-
 
||01:30
 
||01:30
Line 70: Line 70:
 
|-
 
|-
 
||01:34
 
||01:34
||In  the '''“while'''” loop, the code inside the loop repeats till '''boolean''' evaluates to '''false'''.
+
||In  the '''“while'''” loop, the code inside the loop repeats till '''Boolean''' evaluates to "false".
 
|-
 
|-
 
||01:42
 
||01:42
||Let me explain the structure of '''“while”''' loop.
+
||Let me explain the structure of '''“while”''' loop:
'''while loop condition''' {  
+
'''while 'loop condition'''' {  
+
''do something''  
''do something ''  
+
'''with loop increment variable
 
+
'''with loop increment variable
+
 
}'''
 
}'''
 
|-
 
|-
 
||01:56
 
||01:56
||I already have the code in a '''text editor'''.
+
||I already have the code in a text-editor.
 
|-
 
|-
 
||01:59
 
||01:59
Line 92: Line 90:
 
|-
 
|-
 
|02:13
 
|02:13
|Resume the tutorial after typing the program
+
|Resume the tutorial after typing the program.
 
|-
 
|-
 
||02:18
 
||02:18
Line 101: Line 99:
 
|-
 
|-
 
||02:27
 
||02:27
||'#' sign comments a line written after it.  
+
||'#' hyash sign comments a line written after it.  
 
|-
 
|-
 
|02:32
 
|02:32
Line 113: Line 111:
 
|-
 
|-
 
||02:52
 
||02:52
||Message in a program is given within double quotes after the keyword  '''message " "''', 
+
||Message in a program is given within double quotes after the keyword  "message". '''“message”''' command takes '''string''' as input.  
'''“message”''' command takes '''“string”''' as input.  
+
 
|-
 
|-
 
|03:04
 
|03:04
||It shows a pop-up dialog box containing text from the '''string'''.  
+
||It shows a pop-up dialog-box containing text from the '''string'''.  
 
|-
 
|-
 
||03:11
 
||03:11
||'''while $x<30''' checks the '''“while”''' condition,  
+
||'''while $x<30''' checks the “while” condition,  
 
|-
 
|-
 
||03:17
 
||03:17
Line 132: Line 129:
 
|-
 
|-
 
||03:42
 
||03:42
||'''forward 20''' commands '''“Turtle”''' to move 20 steps forward on the canvas.
+
||'''forward 20''' commands '''Turtle''' to move 20 steps forward on the canvas.
 
|-
 
|-
 
||03:52
 
||03:52
Line 138: Line 135:
 
|-
 
|-
 
||04:01
 
||04:01
||Let me click on the '''“Run”''' button to '''run''' the program.
+
||Let me click on the '''Run''' button to '''run''' the program.
  
 
|-
 
|-
 
|04:05
 
|04:05
||A message dialog box pops up. Let me click '''OK'''.
+
||A message dialog-box pops up. Let me click '''OK'''.
 
|-
 
|-
 
||04:11
 
||04:11
Line 148: Line 145:
 
|-
 
|-
 
|04:17
 
|04:17
||'''“Turtle”''' moves 20 steps forward on the canvas.  
+
||'''Turtle''' moves 20 steps forward on the canvas.  
 
|-
 
|-
 
||04:22
 
||04:22
||Let's next work with '''“for”''' loop.
+
||Let's next work with “for” loop.
 
|-
 
|-
 
||04:26
 
||04:26
Line 158: Line 155:
 
|-
 
|-
 
|04:29
 
|04:29
||Every time  the code inside '''“for”''' loop is executed,
+
||Every time  the code inside '''for''' loop is executed,
  
 
|-
 
|-
Line 165: Line 162:
 
|-
 
|-
 
||04:41
 
||04:41
||Let me explain the structure of '''“for”''' loop.
+
||Let me explain the structure of “for” loop.
  
 
|-
 
|-
Line 176: Line 173:
 
|-
 
|-
 
|04:59
 
|04:59
||Let me type '''clear'''command and '''run''' to clean the canvas.
+
||Let me type "clear" command and '''run''' to clean the canvas.
 
|-
 
|-
 
||05:05
 
||05:05
||Let me copy the program from text editor and paste it into 'KTurtle editor'.
+
||Let me copy the program from text-editor and paste it into KTurtle editor.
  
 
|-
 
|-
Line 196: Line 193:
 
|-
 
|-
 
||05:34
 
||05:34
||'#' sign comments a line written after it.
+
||'#' hyash sign comments a line written after it.
 
|-
 
|-
 
||05:39
 
||05:39
||'''reset''' command sets '''“Turtle”''' to its '''default''' position.
+
||'''reset''' command sets '''Turtle''' to its '''default''' position.
 
|-
 
|-
 
||05:44
 
||05:44
Line 205: Line 202:
 
|-
 
|-
 
||05:52
 
||05:52
||'''for $x= 1 to 15''' checks '''“for”''' condition  from 1 to 15.
+
||'''for $x= 1 to 15''' checks “for” condition  from 1 to 15.
 
|-
 
|-
 
||06:01
 
||06:01
Line 211: Line 208:
 
|-
 
|-
 
||06:12
 
||06:12
||'''fontsize 18''' sets the font size used by '''print''' command.  
+
||'''fontsize 18''' sets the font-size used by '''print''' command.  
 
|-
 
|-
 
||06:19
 
||06:19
Line 223: Line 220:
 
|-
 
|-
 
||06:48
 
||06:48
||'''“Turtle”''' displays all print commands without any time gap.
+
||“Turtle” displays all print commands without any time gap.
 
|-
 
|-
 
|06:54
 
|06:54
||'''“Wait 2”''' command makes Turtle to '''“wait”''' for 2 seconds before executing next command.
+
||“Wait 2” command makes Turtle to wait for 2 seconds, before executing next command.
 
|-
 
|-
 
||07:04
 
||07:04
||'''“print”''' command displays the '''string''' within double quotes and also displays variable '$r'.
+
||“print” command displays the '''string''' within double quotes and also displays variable '$r'.
 
|-
 
|-
 
||07:13
 
||07:13
||Let me click on the '''“ Run”''' button to '''run''' the program.
+
||Let me click on the ''' Run''' button to '''run''' the program.
  
 
|-
 
|-
Line 249: Line 246:
 
|-
 
|-
 
|07:40
 
|07:40
||In this tutorial we have learned to use  
+
||In this tutorial, we have learned to use  
  
 
|-
 
|-
 
|07:44
 
|07:44
|| '''“while”''' loop and'' “for” ''' loop.
+
|| “while” loop and “for” loop.
  
 
|-
 
|-
Line 261: Line 258:
 
|-
 
|-
 
|07:54   
 
|07:54   
||* Multiples of 2 using '''“while”''' loop.
+
||* Multiples of 2 using “while” loop.
  
 
|-
 
|-
 
|07:58
 
|07:58
||*Multiplication table of a number using '''“for”'''  loop.
+
||* Multiplication table of a number using “for” loop.
 
|-
 
|-
 
||08:03
 
||08:03
Line 280: Line 277:
 
|-
 
|-
 
|08:17
 
|08:17
||The Spoken Tutorial Project team:
+
||The Spoken Tutorial project team:
  
 
|-
 
|-

Revision as of 12:43, 25 February 2016

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:
  • Ubuntu Linux OS Version 12.04
  • KTurtle version 0.8.1 beta.
00:32 We assume that you have basic working knowledge of Kturtle.
00:38 If not, for relevant tutorials, please visit our website:

http://spoken-tutorial.org

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:

http://spoken-tutorial.org/What_is_a_Spoken-Tutorial

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:

http://spoken-tutorial.org/NMEICT-Intro

08:54 This is Madhuri Ganpathi from IIT Bombay, signing off.

Thank you for joining.

Contributors and Content Editors

PoojaMoolya, Pratik kamble, Sandhya.np14, Sneha