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

From Script | Spoken-Tutorial
Jump to: navigation, search
(Created page with '{|border =1 !Visual Cue !Narration |- ||Slide Number 1 || Hello everybody. Hello Everybody. Welcome to this tutorial on '''Control Execution''' in '''KTurtle''' |- ||Slide N…')
 
Line 16: Line 16:
 
Learning Objectives
 
Learning Objectives
 
||In this tutorial, we will learn  
 
||In this tutorial, we will learn  
'while' loop  and
+
''''while'''' loop  and
'for' loop
+
''''for'''' loop
 
|-
 
|-
Spoken Tutorial Project is a part of the Talk to a Teacher project
+
||Slide Number 2
  
It is supported by the National Mission on Education through ICT, MHRD, Government of India
+
Learning Objectives
More information on this Mission is available at this link
+
||In this tutorial, we will learn
http://spoken-tutorial.org/NMEICT-Intro ]
+
* 'while' loop  and
 +
* 'for' loop
 +
|-
 +
|| Slide Number 3
  
This is Madhuri Ganpathi from IIT Bombay signing off
+
'''System Requirement'''
Thank you  for joiningSlide number 13 The Spoken Tutorial Project Team :
+
||To record this tutorial I am using,
  
Conducts workshops using spoken tutorials
+
Ubuntu Linux OS Version 12.04
Gives certificates to those who pass an online test
+
For more details, please write to
+
contact@spoken-tutorial.orgSlide Number 13
+
Watch the video available at  this URL
+
http://spoken-tutorial.org/What is a Spoken Tutorial
+
It summarises the Spoken Tutorial project
+
If you do not have good bandwidth,
+
you can download and watch it Slide number 11
+
AcknowledgementAs an assignment I would like you to write programs to evaluate
+
Multiples of 2 using “while” loop
+
Multiplication table of a number using “for”  loopSlide Number 12
+
AssignmentLet us summarize.
+
In this tutorial we have learnt to use,
+
“while” loop and
+
“for” loopSlide Number 11
+
SummaryWith this we come to end of this tutorial. Let me click the “ Run” button to run the program.
+
A series of sum of first 15 numbers and  sum of first 15 natural numbers is displayed on the canvas.
+
Turtle moves 15 steps forward.Run the program“print” command displays the “string” within double quotes and also displays variable $r.print "Sum of first 15 natural numbers ="+$r“Turtle” displays all print commands without any time gap.
+
“Wait 2” command makes Turtle to “wait” for 2 seconds before executing next command.Highlight wait 2go 10,250  commands  Turtle to go 10 pixels from left of canvas and 250 pixels from top of canvas.Highlight go 10,250forward 15  moves Turtle 15 steps foward.Highlight forward 15print $r displays the variable r.Highlight print $rfontsize 18 sets the font size used by print command. Highlight fontsize 18$r=$x*($x+1)/2 calculates the value of variable r.Highlight $r=$x*($x+1)/2for $x= 1 to 15 checks “for” condition  from 1 to 15.Highlight for $x= 1 to 15$r=0 initialises the value of variable r to zero.Highlight $r=0reset command sets “Turtle” to default position.Highlight reset# sign comments a line written after it.Highlight #Let me explain the code.Let me zoom into the program text it may possibly be a little blurred.Let me copy the program and paste it into KTurtle editor
+
  
 +
KTurtle version 0.8.1 beta.
 +
|-
 +
||Slide  Number 4
  
Please pause the tutorial here and type the program into your KTurtle editor.
+
'''Pre-requisites'''
Please resume the turtorial after typing the program.#program print to sum of first 15 natural numbers
+
We assume that you have basic working knowledge of Kturtle.  
reset
+
$r=0
+
for $x= 1 to 15{
+
$r=$x*($x+1)/2
+
fontsize 18
+
print $r
+
forward 15
+
}
+
go 10,250
+
wait 2
+
print "Sum of first 15 natural numbers ="+$rLet me clear the current program.
+
Let me type clear command and run to clean the canvas.Clear the editor and canvasLet me explain the structure of “for” loop.
+
for variable = start number to end number  { Statement}Slide Number 10
+
Syntax of “for” loop“for” loop is a counting loop.
+
          Every time  the code inside “for” loop is executed,
+
variable value is incremented, till it reaches  the end value.Slide Number  9Let's next work with “for” loopMultiples of 3 from 3 to 30 are displayed on the canvas.
+
“Turtle” moves 20 steps forward on the canvas. Run the programLet me click on the “Run” button to run the program.
+
  
A message dialog box pops up.
+
If not,  
Let me click OK.Run the programprint $x displays the value of variable x on the canvas.Highlight print $x forward 20 commands “Turtle” to move 20 steps forward on the canvas.Highlight forward 20 fontsize 15  sets the font size used by print command.
+
Fontsize takes number as input, set in pixels.Highlight fontsize 15$x=$x+3  increments the value of  variable $x by 3Highlight $x=$x+3while $x<30 checks the “while” condition. Highlight while $x<30Message in a program is given within double quotes after the keyword  message " " 
+
“message” command takes “string” as input.
+
It shows a pop-up dialog box containing text from the string. Highlight message" "$x=0 initialises the value of variable x to zero.Highlight $xreset command sets “Turtle” to its default position.Highlight reset# sign comments a line written after it.
+
It means, this line will not be executed while running the program.Highlight #Let me explain the code.Let me zoom into the program text it may possibly be a little blurred.Let me copy the program from text editor and paste it into KTurtle editor
+
  
 
+
for relevant tutorials, please visit our website.
Please pause the tutorial here and type the program into your KTurtle editor.
+
http://spoken-tutorial.org
Please resume the turtorial after typing the program#program to print a series of multiples 3 upto 30
+
|-
reset
+
||Switch to KTurtle Application
$x=0
+
Dash home >>Search bar appears>>
message"In while loop, code inside the loop repeats till boolean evaluates false"
+
In the Search bar type KTurtle
while $x<30 {
+
||Let's open a new KTurtle Application.
$x=$x+3
+
fontsize 15
+
forward 20
+
print $x
+
}
+
I already have the code in a text editor.Let me explain the structure of “while” loop.
+
while loop condition {
+
  do something
+
  with  loop increment variable
+
}Slide Number 8
+
Syntax of  “while” loopIn  the “while” loop, the code inside the loop repeats till boolean evaluates to 'false'.
+
Slide Number 7Let's begin the tutorial with “while” loopLoop is a block of code is executed repeatedly untill a certain condition is satisfied.
+
Eg. “while” loop and “for” loopSlide Number 6
+
LoopControl execution is controlling the flow of a program.
+
 
+
Different conditions are used to control  program  execution.Slide Number 5
+
Control executionLet me first explain about what is control execution.Let's open a new KTurtle Application.
+
 
Click on  Dash  home. The Search bar appears.
 
Click on  Dash  home. The Search bar appears.
 
In the Search bar, type KTurtle.
 
In the Search bar, type KTurtle.
 
Click on the option.
 
Click on the option.
KTurtle Application opens.Switch to KTurtle Application
+
KTurtle Application opens.
Dash  home >>Search bar appears>>
+
|-
In the Search bar type KTurtleWe assume that you have basic working knowledge of Kturtle.  
+
||
 +
||Let me first explain about what is control execution.
 +
|-
 +
||Slide Number 5
  
If not,
+
Control execution
 +
||Control execution is controlling the flow of a program.
  
for relevant tutorials, please visit our website.  
+
Different conditions are used to control  program  execution.
http://spoken-tutorial.orgSlide  Number 4
+
|-
Pre-requisitesTo record this tutorial I am using,
+
||Slide Number 6
  
Ubuntu Linux OS Version 12.04
+
Loop
 +
||Loop is a block of code is executed repeatedly untill a certain condition is satisfied.
 +
Eg. “while” loop and  “for” loop
 +
|-
 +
||
 +
||Let's begin the tutorial with “while” loop
 +
|-
 +
||Slide Number 7
 +
“while”  loop
 +
||In  the “while” loop, the code inside the loop repeats till boolean evaluates to 'false'.
 +
|-
 +
||Slide Number 8
  
KTurtle version 0.8.1 beta. Slide Number 3
+
Syntax of  “while” loop
 
+
||Let me explain the structure of “while” loop.
System Requirement
+
while loop condition {
 +
  do something
 +
  with  loop increment variable
 +
}
 +
|-

Revision as of 16:41, 26 December 2012

Visual Cue Narration
Slide Number 1

Hello everybody.

Hello Everybody.

Welcome to this tutorial on Control Execution in KTurtle

Slide Number 2

Learning Objectives

In this tutorial, we will learn

'while' loop and 'for' loop

Slide Number 2

Learning Objectives

In this tutorial, we will learn
  • 'while' loop and
  • 'for' loop
Slide Number 3

System Requirement

To record this tutorial I am using,

Ubuntu Linux OS Version 12.04

KTurtle version 0.8.1 beta.

Slide Number 4

Pre-requisites We assume that you have basic working knowledge of Kturtle.

If not,

for relevant tutorials, please visit our website. http://spoken-tutorial.org

Switch to KTurtle Application

Dash home >>Search bar appears>> In the Search bar type KTurtle

Let's open a new KTurtle Application.

Click on Dash home. The Search bar appears. In the Search bar, type KTurtle. Click on the option. KTurtle Application opens.

Let me first explain about what is control execution.
Slide Number 5

Control execution

Control execution is controlling the flow of a program.

Different conditions are used to control program execution.

Slide Number 6

Loop

Loop is a block of code is executed repeatedly untill a certain condition is satisfied.

Eg. “while” loop and “for” loop

Let's begin the tutorial with “while” loop
Slide Number 7

“while” loop

In the “while” loop, the code inside the loop repeats till boolean evaluates to 'false'.
Slide Number 8

Syntax of “while” loop

Let me explain the structure of “while” loop.

while loop condition {

 do something 
 with  loop increment variable

}

Contributors and Content Editors

Madhurig