Difference between revisions of "KTurtle/C2/Grammar-of-TurtleScript/English-timed"
From Script | Spoken-Tutorial
(Created page with '{|border =1 !Visual Cue !Narration |- ||00.01 ||Hello everybody. |- ||00.02 ||Welcome to this tutorial on '''Grammar of TurtleScript''' in '''KTurtle'''. |- ||00.08 ||In this …') |
PoojaMoolya (Talk | contribs) |
||
(8 intermediate revisions by 4 users not shown) | |||
Line 1: | Line 1: | ||
{|border =1 | {|border =1 | ||
− | + | |'''Time''' | |
− | + | |'''Narration''' | |
− | | | + | |
− | | | + | |
− | + | ||
|- | |- | ||
− | ||00 | + | ||00:01 |
− | ||Welcome to this tutorial on '''Grammar of TurtleScript''' in '''KTurtle'''. | + | ||Hello everybody.Welcome to this tutorial on '''Grammar of TurtleScript''' in '''KTurtle'''. |
+ | |||
|- | |- | ||
− | ||00 | + | ||00:08 |
||In this tutorial, we will learn about | ||In this tutorial, we will learn about | ||
|- | |- | ||
− | ||00 | + | ||00:11 |
− | || | + | ||grammar of '''Turtle script''' and ''''if'-'else'''' condition. |
+ | |||
|- | |- | ||
− | ||00 | + | ||00:16 |
− | ||To record this tutorial I am using | + | ||To record this tutorial, I am using: |
+ | '''Ubuntu Linux OS''' version '''12.04''' | ||
+ | '''KTurtle''' version '''0.8.1''' '''beta'''. | ||
+ | |||
|- | |- | ||
− | || 00 | + | ||00:29 |
− | ||We assume that you have basic working knowledge of KTurtle | + | ||We assume that you have basic working knowledge of KTurtle. |
|- | |- | ||
− | ||00 | + | ||00:35 |
− | ||If not, for relevant tutorials, please visit our website | + | ||If not, for relevant tutorials, please visit our website: http://spoken-tutorial.org |
+ | |||
|- | |- | ||
− | ||00 | + | ||00:40 |
− | ||Let's open a new '''KTurtle''' Application. | + | ||Let's open a new '''KTurtle''' '''Application'''. |
|- | |- | ||
− | ||00 | + | ||00:43 |
||Click on '''Dash home'''. | ||Click on '''Dash home'''. | ||
|- | |- | ||
− | ||00 | + | ||00:45 |
− | ||In the Search bar | + | ||In the '''Search bar''', type: "kturtle". |
|- | |- | ||
− | ||00 | + | ||00:49 |
||Click on the '''KTurtle''' icon. | ||Click on the '''KTurtle''' icon. | ||
+ | |||
|- | |- | ||
− | ||00 | + | ||00:52 |
− | ||We | + | ||We can also open KTurtle using '''Terminal.''' |
|- | |- | ||
− | ||00 | + | ||00:56 |
− | ||Press ''' | + | ||Press '''Ctrl+Alt+T''' keys simultaneously to open the Terminal. |
|- | |- | ||
− | ||01 | + | ||01:01 |
− | ||Type ''' | + | ||Type '''kturtle''' and press '''Enter''' to open the 'KTurtle' Application. |
+ | |||
|- | |- | ||
− | ||01 | + | ||01:08 |
− | ||Let's first look at '''TurtleScript''' | + | ||Let's first look at '''TurtleScript'''. |
|- | |- | ||
− | ||01 | + | ||01:11 |
− | || '''TurtleScript''' is a programming language | + | ||'''TurtleScript''' is a programming language. |
|- | |- | ||
− | ||01 | + | ||01:15 |
− | ||It has different types of | + | ||It has different types of words and symbols used for various purposes. |
|- | |- | ||
− | ||01 | + | ||01:21 |
− | || It | + | ||It instructs Turtle what to do. |
+ | |||
|- | |- | ||
− | ||01 | + | ||01:25 |
||'''Grammar of TurtleScript''' in ''' KTurtle''' includes- | ||'''Grammar of TurtleScript''' in ''' KTurtle''' includes- | ||
|- | |- | ||
− | ||01 | + | ||01:30 |
− | || Comments | + | ||'''Comments''', '''Commands''' |
|- | |- | ||
− | ||01 | + | ||01:32 |
− | || | + | || Numbers, '''Strings''' |
|- | |- | ||
− | ||01 | + | ||01:34 |
− | || | + | ||'''Variable'''s and |
|- | |- | ||
− | ||01 | + | ||01:36 |
− | || | + | ||'''Boolean value'''s. |
|- | |- | ||
− | ||01 | + | ||01:38 |
− | || | + | ||Now, we will see where to store numbers. |
|- | |- | ||
− | ||01 | + | ||01:42 |
− | || | + | ||'''Numbers''' can be stored in: |
− | + | ||
− | + | ||
− | + | ||
|- | |- | ||
− | ||01 | + | ||01:44 |
− | || | + | ||Mathematical operators |
|- | |- | ||
− | ||01 | + | ||01:46 |
− | || | + | ||Comparison operators and |
|- | |- | ||
− | ||01 | + | ||01:49 |
− | || | + | ||Variables,I will zoom the program text for clear view. |
|- | |- | ||
− | ||01 | + | ||01:54 |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
||First let's look at variables. | ||First let's look at variables. | ||
|- | |- | ||
− | ||01 | + | ||01:57 |
||Variables are words that start with ‘$’ sign, for example $a. | ||Variables are words that start with ‘$’ sign, for example $a. | ||
|- | |- | ||
− | || 02 | + | ||02:04 |
− | || | + | ||Variables are highlighted in purple color. |
|- | |- | ||
− | ||02 | + | ||02:09 |
− | ||Using the assignment | + | ||Using the assignment '''equal to''' (=), a variable is given its contents. |
|- | |- | ||
− | ||02 | + | ||02:14 |
− | ||Variables can contain | + | ||Variables can contain- * numbers '''$a=100'''. |
|- | |- | ||
− | ||02 | + | ||02:20 |
− | || | + | ||'''string'''s '''$a=hello''' or |
|- | |- | ||
− | ||02 | + | ||02:25 |
− | ||boolean values that is true or false '''$a=true''' | + | ||boolean values that is '''true''' or '''false''' '''$a=true'''. |
|- | |- | ||
− | ||02 | + | ||02:32 |
− | ||Variable keeps the | + | ||Variable keeps the contents until program finishes execution or until it is reassigned to something else. |
|- | |- | ||
− | ||02 | + | ||02:41 |
||For example, consider the code. | ||For example, consider the code. | ||
|- | |- | ||
− | ||02 | + | ||02:44 |
− | ||Let us type | + | ||Let us type:'''$a = 2004''' |
|- | |- | ||
− | ||02 | + | ||02:50 |
||'''$b = 25''' | ||'''$b = 25''' | ||
|- | |- | ||
− | ||02 | + | ||02:55 |
||'''print $a + $b''' | ||'''print $a + $b''' | ||
+ | |||
|- | |- | ||
− | ||03 | + | ||03:01 |
||Variable 'a' is assigned a value ''' 2004.''' | ||Variable 'a' is assigned a value ''' 2004.''' | ||
|- | |- | ||
− | ||03 | + | ||03:06 |
− | ||Variable 'b' is assigned a value '''25''' | + | ||Variable 'b' is assigned a value '''25'''. |
|- | |- | ||
− | ||03 | + | ||03:10 |
||'''print''' command, commands Turtle to write something on the canvas. | ||'''print''' command, commands Turtle to write something on the canvas. | ||
|- | |- | ||
− | || 03 | + | ||03:15 |
− | ||'''print''' command | + | ||'''print''' command takes numbers and strings as '''input'''. |
|- | |- | ||
− | ||03 | + | ||03:19 |
||'''print $a + $b''' commands '''Turtle''' to add two values and display them on the canvas. | ||'''print $a + $b''' commands '''Turtle''' to add two values and display them on the canvas. | ||
+ | |||
|- | |- | ||
− | || 03 | + | ||03:29 |
− | ||Let's Run the code in '''slow''' speed. | + | ||Let's '''Run''' the code in '''slow''' speed. |
|- | |- | ||
− | ||03 | + | ||03:34 |
− | ||Value '''2029''' is displayed on the canvas | + | ||Value '''2029''' is displayed on the canvas. |
+ | |||
|- | |- | ||
− | ||03 | + | ||03:40 |
− | ||Let us next see the | + | ||Let us next see the mathematical operators. |
|- | |- | ||
− | ||03 | + | ||03:44 |
− | ||Mathematical operators include | + | ||Mathematical operators include - |
+ | '+' (Addition) | ||
− | + | '-' (Subtraction) | |
− | * | + | '*' (Multiplication) and |
− | + | '/' (Division) | |
− | |||
|- | |- | ||
− | ||03 | + | ||03:53 |
− | || I will clear the current code from editor and type | + | || I will clear the current code from the editor and type "clear" command and '''Run''' to clean the canvas. |
+ | |||
|- | |- | ||
− | ||04 | + | ||04:01 |
− | ||I already have a program in a text editor. | + | ||I already have a program in a text-editor. |
+ | |||
|- | |- | ||
− | ||04 | + | ||04:05 |
− | ||I will | + | ||I will explain the code now. |
+ | |||
|- | |- | ||
− | ||04 | + | ||04:08 |
− | ||'''“reset”''' command sets Turtle to its '''default''' position | + | ||'''“reset”''' command sets Turtle to its '''default''' position. |
+ | |||
|- | |- | ||
− | ||04 | + | ||04:12 |
||'''canvassize 200,200''' fixes the width and height of the canvas to 200 pixels each. | ||'''canvassize 200,200''' fixes the width and height of the canvas to 200 pixels each. | ||
+ | |||
|- | |- | ||
− | ||04 | + | ||04:22 |
− | || | + | || Value '''1+1''' is assigned to the variable''' $add'''. |
+ | |||
|- | |- | ||
− | ||04 | + | ||04:26 |
− | ||Value '''20-5''' is assigned to variable '''$subtract''' | + | ||Value '''20-5''' is assigned to the variable '''$subtract'''. |
+ | |||
|- | |- | ||
− | ||04 | + | ||04:31 |
− | || | + | ||Value '''15 * 2''' is assigned to the variable '''$multiply.''' |
+ | |||
|- | |- | ||
− | ||04 | + | ||04:36 |
||'''30/30''' is assigned to the variable '''$divide.''' | ||'''30/30''' is assigned to the variable '''$divide.''' | ||
+ | |||
|- | |- | ||
− | ||04 | + | ||04:40 |
− | ||'''go 10,10''' commands | + | ||'''go 10,10''' commands '''Turtle''' to go 10 pixels left of canvas and 10 pixels from top of canvas. |
+ | |||
|- | |- | ||
− | ||04 | + | ||04:52 |
− | ||'''print''' command displays the | + | ||'''print''' command displays the variable on the canvas. |
+ | |||
|- | |- | ||
− | ||04 | + | ||04:56 |
− | ||I will copy the code from text editor and paste it into '''KTurtle''' editor. | + | ||I will '''copy''' the code from text-editor and '''paste''' it into '''KTurtle''' editor. |
|- | |- | ||
− | ||05 | + | ||05:03 |
− | ||Pause the tutorial and type the program into''' KTurtle''' editor. | + | ||Pause the tutorial here and type the program into your ''' KTurtle''' editor. |
|- | |- | ||
− | ||05 | + | ||05:08 |
− | ||Resume the tutorial after typing the program | + | ||Resume the tutorial after typing the program. |
+ | |||
|- | |- | ||
− | ||05 | + | ||05:13 |
− | ||Let us click on '''Run''' button to run the program | + | ||Let us click on '''Run''' button to '''run''' the program. |
|- | |- | ||
− | ||05 | + | ||05:17 |
||Command which is getting executed is highlighted on the editor. | ||Command which is getting executed is highlighted on the editor. | ||
|- | |- | ||
− | ||05 | + | ||05:22 |
||'''Turtle''' displays the values on the canvas at the specified positions. | ||'''Turtle''' displays the values on the canvas at the specified positions. | ||
+ | |||
|- | |- | ||
− | ||05 | + | ||05:34 |
||Let us consider a simple example for using '''comparison operator''' . | ||Let us consider a simple example for using '''comparison operator''' . | ||
+ | |- | ||
+ | ||05:41 | ||
+ | ||I will clear the current code from the editor. Type '''"clear"''' command and '''Run''' to clean the canvas. | ||
|- | |- | ||
− | || 05 | + | ||05:49 |
− | || I will | + | ||I will zoom the program text to have a clear view. |
+ | |||
|- | |- | ||
− | || 05 | + | ||05:53 |
− | + | ||Let's type: | |
− | + | ||
− | + | ||
− | ||Let's type | + | |
|- | |- | ||
− | ||05 | + | ||05:55 |
||'''$answer = 10 > 3''' | ||'''$answer = 10 > 3''' | ||
|- | |- | ||
− | ||06 | + | ||06:03 |
||'''print $answer''' | ||'''print $answer''' | ||
|- | |- | ||
− | ||06 | + | ||06:09 |
− | ||Here 10 is compared to 3 with the | + | ||Here, 10 is compared to 3 with the '''greater than''' operator. |
|- | |- | ||
− | ||06 | + | ||06:14 |
− | ||The result of this comparison, the '''boolean value | + | ||The result of this comparison, the '''boolean value''' 'true', is stored in the |
|- | |- | ||
− | ||06 | + | ||06:19 |
− | ||variable '''$answer''' and the value | + | ||variable '''$answer''' and the value 'true' is displayed on the canvas. |
+ | |||
|- | |- | ||
− | || 06 | + | ||06:27 |
− | ||Let's run the code now | + | ||Let's run the code now. |
|- | |- | ||
− | ||06 | + | ||06:29 |
− | ||'''Turtle''' displays | + | ||'''Turtle''' displays Boolean value 'true' on the canvas. |
+ | |||
|- | |- | ||
− | ||06 | + | ||06:34 |
− | ||Now | + | ||Now,let's see how '''String'''s work in this application- |
|- | |- | ||
− | ||06 | + | ||06:39 |
− | ||Strings can be put in variables like numbers | + | ||Strings can be put in variables like numbers. |
|- | |- | ||
− | ||06 | + | ||06:43 |
− | ||Strings cannot be used in mathematical or comparison operators | + | ||Strings cannot be used in mathematical or comparison operators. |
|- | |- | ||
− | ||06 | + | ||06:49 |
− | ||Strings are highlighted in red color | + | ||Strings are highlighted in red color. |
|- | |- | ||
− | ||06 | + | ||06:53 |
− | ||KTurtle identifies a line in double quotes as a string | + | ||'KTurtle' identifies a line in double quotes as a string. |
+ | |||
|- | |- | ||
− | || 07 | + | ||07:00 |
− | ||I will clear the current code from editor. | + | ||I will clear the current code from editor. Type "clear" command and '''Run''' to clean the canvas. |
+ | |||
|- | |- | ||
− | || | + | ||07:08 |
− | ||Now | + | ||Now, I will explain about Boolean values. |
|- | |- | ||
− | ||07 | + | ||07:11 |
− | ||There are only two '''boolean''' values: | + | ||There are only two '''boolean''' values: "true" and "false". |
+ | |||
|- | |- | ||
− | ||07 | + | ||07:16 |
− | ||For example | + | ||For example, let's type the code: |
|- | |- | ||
− | ||07 | + | ||07:20 |
||'''$answer = 7<5''' | ||'''$answer = 7<5''' | ||
|- | |- | ||
− | ||07 | + | ||07:28 |
− | ||'''print $answer''' | + | ||'''print $answer'''. |
|- | |- | ||
− | ||07 | + | ||07:34 |
− | ||'''Boolean value | + | ||The '''Boolean value''' 'false' is assigned to the variable''' $answer''' because 7 is greater than 5. |
+ | |||
|- | |- | ||
− | || 07 | + | ||07:43 |
− | ||Let's Run the code now | + | ||Let's '''Run''' the code now. |
|- | |- | ||
− | ||07 | + | ||07:47 |
− | ||'''Turtle''' | + | ||'''Turtle''' displays '''Boolean''' value "false" on the canvas. |
+ | |||
|- | |- | ||
− | || 07 | + | ||07:51 |
||Let's next learn about “if-else” conditon. | ||Let's next learn about “if-else” conditon. | ||
|- | |- | ||
− | ||07 | + | ||07:56 |
− | ||‘if’ condition is executed only if the | + | ||‘if’ condition is executed only if the boolean value evaluates ‘true’. |
|- | |- | ||
− | ||08 | + | ||08:03 |
− | ||‘else’ condition is executed only if the ‘if’ condition is ‘false’ . | + | ||‘else’ condition is executed only if the ‘if’ condition is ‘false’. |
+ | |||
|- | |- | ||
− | || 08 | + | ||08:09 |
− | ||I will clear the current code from editor. | + | ||I will clear the current code from editor. Type "clear" command and '''Run''' to clean the canvas. |
+ | |||
|- | |- | ||
− | ||08 | + | ||08:17 |
||I already have a code in a text file. | ||I already have a code in a text file. | ||
+ | |||
|- | |- | ||
− | || 08 | + | ||08:21 |
− | ||This code compares | + | ||This code compares numbers 4 , 5 and 6 and displays the results accordingly on the canvas. |
+ | |||
|- | |- | ||
− | ||08 | + | ||08:30 |
− | ||I will copy the code from text editor and paste it into '''KTurtle''' editor. | + | ||I will copy the code from text-editor and paste it into '''KTurtle''' editor. |
|- | |- | ||
− | ||08 | + | ||08:36 |
− | ||Pause the tutorial and type the program into your '''KTurtle''' editor. | + | ||Pause the tutorial here and type the program into your '''KTurtle''' editor. |
|- | |- | ||
− | ||08 | + | ||08:42 |
− | ||Resume the tutorial after typing the program | + | ||Resume the tutorial after typing the program. |
+ | |||
|- | |- | ||
− | || 08 | + | ||08:46 |
− | ||Let's | + | ||Let's '''run''' the code now. |
|- | |- | ||
− | ||08 | + | ||08:49 |
− | || | + | ||The '''Turtle''' has compared the values 4 and 5 |
|- | |- | ||
− | ||08 | + | ||08:53 |
− | ||and has displayed the | + | ||and has displayed the result: "4 is smaller than 6" on the canvas. |
+ | |||
|- | |- | ||
− | ||09 | + | ||09:00 |
||With this we come to the end of this tutorial. | ||With this we come to the end of this tutorial. | ||
|- | |- | ||
− | ||09 | + | ||09:05 |
||Let's summarize. | ||Let's summarize. | ||
+ | |||
|- | |- | ||
− | ||09 | + | ||09:07 |
− | ||In this tutorial, we have learnt about | + | ||In this tutorial, we have learnt about: |
|- | |- | ||
− | ||09 | + | ||09:11 |
||Grammar of Turtle script and | ||Grammar of Turtle script and | ||
|- | |- | ||
− | ||09 | + | ||09:14 |
− | || ‘if-else’ condition | + | ||‘if-else’ condition. |
+ | |||
|- | |- | ||
− | ||09 | + | ||09:17 |
− | ||Now to the assignment part. | + | ||Now, to the assignment part. |
|- | |- | ||
− | ||09 | + | ||09:19 |
− | || | + | ||Solve an equation using: |
|- | |- | ||
− | ||09 | + | ||09:22 |
− | ||if - else condition | + | ||if - else condition, |
|- | |- | ||
− | ||09 | + | ||09:24 |
− | || Mathematical and | + | ||Mathematical and comparison operators. |
|- | |- | ||
− | ||09 | + | ||09:27 |
− | || Display the results using “print” and “go” commands. | + | ||Display the results using “print” and “go” commands. |
+ | |||
|- | |- | ||
− | ||09 | + | ||09:33 |
− | ||To solve the assignment | + | ||To solve the assignment- |
|- | |- | ||
− | ||09 | + | ||09:35 |
− | || | + | ||choose any four random numbers, |
|- | |- | ||
− | ||09 | + | ||09:38 |
− | || | + | ||multiply two sets of random numbers, |
|- | |- | ||
− | ||09 | + | ||09:42 |
− | || | + | ||compare the results using the comparison operators, |
|- | |- | ||
− | ||09 | + | ||09:46 |
− | || | + | ||display both the results, |
|- | |- | ||
− | ||09 | + | ||09:49 |
− | || | + | ||display greater result at the center of the canvas. |
|- | |- | ||
− | ||09 | + | ||09:54 |
− | || You can choose any equation which you like. | + | ||You can choose any equation which you like. |
+ | |||
|- | |- | ||
− | ||09 | + | ||09:59 |
− | ||Watch the video available at this URL | + | ||Watch the video available at this URL: http://spoken-tutorial.org/What_is_a_Spoken-Tutorial |
|- | |- | ||
− | ||10 | + | ||10:03 |
− | ||It | + | ||It summarizes the Spoken Tutorial project. |
|- | |- | ||
− | ||10 | + | ||10:06 |
− | ||If you do not have good bandwidth, you can download and watch it | + | ||If you do not have good bandwidth, you can download and watch it. |
|- | |- | ||
− | || 10 | + | ||10:12 |
− | ||The Spoken Tutorial | + | ||The Spoken Tutorial project team : |
|- | |- | ||
− | ||10 | + | ||10:14 |
− | ||Conducts workshops using spoken tutorials | + | ||Conducts workshops using spoken tutorials. |
|- | |- | ||
− | ||10 | + | ||10:18 |
− | ||Gives certificates to those who pass an online test | + | ||Gives certificates to those who pass an online test. |
|- | |- | ||
− | ||10 | + | ||10:22 |
− | ||For more details, please write to | + | ||For more details, please write to: contact@spoken-tutorial.org |
+ | |||
|- | |- | ||
− | || 10 | + | ||10:30 |
− | ||Spoken Tutorial | + | ||'''Spoken Tutorial''' project is a part of the '''Talk to a Teacher''' project. |
|- | |- | ||
− | ||10 | + | ||10:35 |
− | ||It is supported by the National Mission on Education through ICT, MHRD, Government of India | + | ||It is supported by the National Mission on Education through ICT, MHRD, Government of India. |
|- | |- | ||
− | || | + | ||10:43 |
− | ||More information on this | + | ||More information on this mission is available at this link: http://spoken-tutorial.org/NMEICT-Intro |
|- | |- | ||
− | ||10 | + | ||10:48 |
− | ||The Script is contributed by '''ITfC Bangaluru.''' | + | ||The Script is contributed by '''ITfC, Bangaluru.''' |
|- | |- | ||
− | ||10 | + | ||10:52 |
− | ||This is Madhuri Ganpathi from '''IIT Bombay''' signing off Thank you for joining. | + | ||This is Madhuri Ganpathi from '''IIT Bombay''', signing off. Thank you for joining. |
|- | |- |
Latest revision as of 17:12, 24 March 2017
Time | Narration |
00:01 | Hello everybody.Welcome to this tutorial on Grammar of TurtleScript in KTurtle. |
00:08 | In this tutorial, we will learn about |
00:11 | grammar of Turtle script and 'if'-'else' condition. |
00:16 | To record this tutorial, I am using:
Ubuntu Linux OS version 12.04 KTurtle version 0.8.1 beta. |
00:29 | We assume that you have basic working knowledge of KTurtle. |
00:35 | If not, for relevant tutorials, please visit our website: http://spoken-tutorial.org |
00:40 | Let's open a new KTurtle Application. |
00:43 | Click on Dash home. |
00:45 | In the Search bar, type: "kturtle". |
00:49 | Click on the KTurtle icon. |
00:52 | We can also open KTurtle using Terminal. |
00:56 | Press Ctrl+Alt+T keys simultaneously to open the Terminal. |
01:01 | Type kturtle and press Enter to open the 'KTurtle' Application. |
01:08 | Let's first look at TurtleScript. |
01:11 | TurtleScript is a programming language. |
01:15 | It has different types of words and symbols used for various purposes. |
01:21 | It instructs Turtle what to do. |
01:25 | Grammar of TurtleScript in KTurtle includes- |
01:30 | Comments, Commands |
01:32 | Numbers, Strings |
01:34 | Variables and |
01:36 | Boolean values. |
01:38 | Now, we will see where to store numbers. |
01:42 | Numbers can be stored in: |
01:44 | Mathematical operators |
01:46 | Comparison operators and |
01:49 | Variables,I will zoom the program text for clear view. |
01:54 | First let's look at variables. |
01:57 | Variables are words that start with ‘$’ sign, for example $a. |
02:04 | Variables are highlighted in purple color. |
02:09 | Using the assignment equal to (=), a variable is given its contents. |
02:14 | Variables can contain- * numbers $a=100. |
02:20 | strings $a=hello or |
02:25 | boolean values that is true or false $a=true. |
02:32 | Variable keeps the contents until program finishes execution or until it is reassigned to something else. |
02:41 | For example, consider the code. |
02:44 | Let us type:$a = 2004 |
02:50 | $b = 25 |
02:55 | print $a + $b |
03:01 | Variable 'a' is assigned a value 2004. |
03:06 | Variable 'b' is assigned a value 25. |
03:10 | print command, commands Turtle to write something on the canvas. |
03:15 | print command takes numbers and strings as input. |
03:19 | print $a + $b commands Turtle to add two values and display them on the canvas. |
03:29 | Let's Run the code in slow speed. |
03:34 | Value 2029 is displayed on the canvas. |
03:40 | Let us next see the mathematical operators. |
03:44 | Mathematical operators include -
'+' (Addition) '-' (Subtraction) '*' (Multiplication) and '/' (Division) |
03:53 | I will clear the current code from the editor and type "clear" command and Run to clean the canvas. |
04:01 | I already have a program in a text-editor. |
04:05 | I will explain the code now. |
04:08 | “reset” command sets Turtle to its default position. |
04:12 | canvassize 200,200 fixes the width and height of the canvas to 200 pixels each. |
04:22 | Value 1+1 is assigned to the variable $add. |
04:26 | Value 20-5 is assigned to the variable $subtract. |
04:31 | Value 15 * 2 is assigned to the variable $multiply. |
04:36 | 30/30 is assigned to the variable $divide. |
04:40 | go 10,10 commands Turtle to go 10 pixels left of canvas and 10 pixels from top of canvas. |
04:52 | print command displays the variable on the canvas. |
04:56 | I will copy the code from text-editor and paste it into KTurtle editor. |
05:03 | Pause the tutorial here and type the program into your KTurtle editor. |
05:08 | Resume the tutorial after typing the program. |
05:13 | Let us click on Run button to run the program. |
05:17 | Command which is getting executed is highlighted on the editor. |
05:22 | Turtle displays the values on the canvas at the specified positions. |
05:34 | Let us consider a simple example for using comparison operator . |
05:41 | I will clear the current code from the editor. Type "clear" command and Run to clean the canvas. |
05:49 | I will zoom the program text to have a clear view. |
05:53 | Let's type: |
05:55 | $answer = 10 > 3 |
06:03 | print $answer |
06:09 | Here, 10 is compared to 3 with the greater than operator. |
06:14 | The result of this comparison, the boolean value 'true', is stored in the |
06:19 | variable $answer and the value 'true' is displayed on the canvas. |
06:27 | Let's run the code now. |
06:29 | Turtle displays Boolean value 'true' on the canvas. |
06:34 | Now,let's see how Strings work in this application- |
06:39 | Strings can be put in variables like numbers. |
06:43 | Strings cannot be used in mathematical or comparison operators. |
06:49 | Strings are highlighted in red color. |
06:53 | 'KTurtle' identifies a line in double quotes as a string. |
07:00 | I will clear the current code from editor. Type "clear" command and Run to clean the canvas. |
07:08 | Now, I will explain about Boolean values. |
07:11 | There are only two boolean values: "true" and "false". |
07:16 | For example, let's type the code: |
07:20 | $answer = 7<5 |
07:28 | print $answer. |
07:34 | The Boolean value 'false' is assigned to the variable $answer because 7 is greater than 5. |
07:43 | Let's Run the code now. |
07:47 | Turtle displays Boolean value "false" on the canvas. |
07:51 | Let's next learn about “if-else” conditon. |
07:56 | ‘if’ condition is executed only if the boolean value evaluates ‘true’. |
08:03 | ‘else’ condition is executed only if the ‘if’ condition is ‘false’. |
08:09 | I will clear the current code from editor. Type "clear" command and Run to clean the canvas. |
08:17 | I already have a code in a text file. |
08:21 | This code compares numbers 4 , 5 and 6 and displays the results accordingly on the canvas. |
08:30 | I will copy the code from text-editor and paste it into KTurtle editor. |
08:36 | Pause the tutorial here and type the program into your KTurtle editor. |
08:42 | Resume the tutorial after typing the program. |
08:46 | Let's run the code now. |
08:49 | The Turtle has compared the values 4 and 5 |
08:53 | and has displayed the result: "4 is smaller than 6" on the canvas. |
09:00 | With this we come to the end of this tutorial. |
09:05 | Let's summarize. |
09:07 | In this tutorial, we have learnt about: |
09:11 | Grammar of Turtle script and |
09:14 | ‘if-else’ condition. |
09:17 | Now, to the assignment part. |
09:19 | Solve an equation using: |
09:22 | if - else condition, |
09:24 | Mathematical and comparison operators. |
09:27 | Display the results using “print” and “go” commands. |
09:33 | To solve the assignment- |
09:35 | choose any four random numbers, |
09:38 | multiply two sets of random numbers, |
09:42 | compare the results using the comparison operators, |
09:46 | display both the results, |
09:49 | display greater result at the center of the canvas. |
09:54 | You can choose any equation which you like. |
09:59 | Watch the video available at this URL: http://spoken-tutorial.org/What_is_a_Spoken-Tutorial |
10:03 | It summarizes the Spoken Tutorial project. |
10:06 | If you do not have good bandwidth, you can download and watch it. |
10:12 | The Spoken Tutorial project team : |
10:14 | Conducts workshops using spoken tutorials. |
10:18 | Gives certificates to those who pass an online test. |
10:22 | For more details, please write to: contact@spoken-tutorial.org |
10:30 | Spoken Tutorial project is a part of the Talk to a Teacher project. |
10:35 | It is supported by the National Mission on Education through ICT, MHRD, Government of India. |
10:43 | More information on this mission is available at this link: http://spoken-tutorial.org/NMEICT-Intro |
10:48 | The Script is contributed by ITfC, Bangaluru. |
10:52 | This is Madhuri Ganpathi from IIT Bombay, signing off. Thank you for joining. |