Difference between revisions of "KTurtle/C3/Question-Glues/English-timed"
From Script | Spoken-Tutorial
Line 56: | Line 56: | ||
||01:40 | ||01:40 | ||
||Please pause the tutorial here and type the program into your '''KTurtle''' editor. | ||Please pause the tutorial here and type the program into your '''KTurtle''' editor. | ||
− | |||
|- | |- |
Revision as of 14:31, 9 July 2014
Time | Narration |
00:01 | Hello and welcome to the spoken tutorial on Question Glues in KTurtle. |
00:08 | In this tutorial, we will learn the following question glues and, not |
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 and “if-else” statement in KTurtle |
00:39 | If not, for relevant tutorials, please visit our website. http://spoken-tutorial.org |
00:46 | Before proceeding, let me explain about question glue words. |
00:51 | Question glue words enable us to glue small questions into one big question. |
01:00 | “and”, “or” and “not” are some glue-words.Glue-words are used together with if-else conditions. |
01:11 | Let's open a new KTurtle Application. |
01:15 | Click on Dash home. |
01:18 | In the Search bar, type KTurtle. |
01:22 | And Click on the option. |
01:24 | Let's begin the tutorial with glue word and. |
01:28 | I already have a program in a text editor. |
01:33 | Let me copy the code from the text editor and paste it into KTurtle editor. |
01:40 | Please pause the tutorial here and type the program into your KTurtle editor. |
01:46 | Resume the tutorial after typing the program. |
01:50 | Let me zoom into the program text. |
01:52 | It may possibly be a little blurred. |
01:56 | Let's look the code. |
01:59 | reset command sets Turtle to its default position. |
02:04 | Message in a program is given within double quotes after the keyword message " " . |
02:10 | “message” command takes “string” as input. |
02:14 | It shows a pop-up dialog box containing text from the string and also generates a beep for non null strings. |
02:24 | $a, $b and $c are variables that store user input. |
02:30 | “ask” command prompts for user input to be stored in variables. |
02:36 | if(($a+$b>$c) and ($b+$c>$a) and ($c+$a>$b), checks the “if” condition. |
02:49 | When the two questions glued with “and” are true, result is true. |
02:55 | 'if(($a !=$b) and ($b != $c) and ($c != $a)) checks the if condition. |
03:05 | when 'if' condition above is true, control moves into nested if block. |
03:12 | It checks whether sides of triangle are unequal. |
03:17 | fontsize 18 sets the font size used by print command. |
03:22 | go 10,100 commands Turtle to go 10 pixels from left of canvas and 100 pixels from top of canvas. |
03:35 | print command displays the string after checking the if condition. |
03:41 | else command checks else condition, when if condition in the block is false |
03:48 | print command displays the string after checking the else condition. |
03:54 | else command checks the final condition. |
03:57 | Here else is checked only when above conditions are false. |
04:03 | print command displays the string after checking the else condition. I will run the code to check all the conditions. |
04:12 | Let's click on the Run button to run the program. |
04:15 | A message dialog box pops- up.Let me click OK. |
04:20 | Let's Enter 5 for 'length of AB' and click OK |
04:25 | 8 for 'length of BC' and click OK |
04:29 | 9 for 'length of AC' and click OK |
04:33 | “A scalene triangle” is displayed on the canvas. |
04:37 | Lets run again. |
04:40 | A message dialog box pops up .Let me click OK. |
04:44 | Lets Enter 5 for length of 'AB' and click OK,6 for length of 'BC' and click OK, 6 for length of 'AC' and click OK. |
04:58 | “ Not a scalene triangle” is displayed on the canvas. |
05:02 | Let's run again to check default condition. |
05:06 | A message dialog box pops up. Let me click ok. |
05:11 | Let's Enter 1 for length of 'AB' and click OK. |
05:16 | 1 for length of 'BC' and click OK. |
05:20 | 2 for length of 'AC' and click OK. |
05:24 | " Does not satisfy triangle's inequality " is displayed on the canvas. |
05:30 | Let's now clear this program. Let me type clear command and run clear command cleans the canvas . |
05:40 | let's next work with 'not condition. |
05:43 | Let me copy the program from the text editor and paste it into KTurtle editor. |
05:51 | Please pause the tutorial here and type the program into your KTurtle editor. |
05:56 | Resume the tutorial after typing the program. |
06:01 | Let me zoom into the program text and explain the program. |
06:05 | reset command sets Turtle to default position. |
06:09 | $a, $b and $c are variables that store user input. |
06:15 | if not (($a==$b) and ($b==$c) and ($c==$a))checks the if not condition. |
06:27 | not is a special question glue-word. It inverses the logical state of its operand. |
06:36 | e.g. If the given condition is true, not makes it false. |
06:42 | And when the condition is false the output will be true. |
06:48 | print command displays the string after checking the if not condition. |
06:55 | else command is executed when if condition is false. |
07:01 | print command displays the string after checking the else condition. |
07:07 | go 100,100 commands Turtle to go 100 pixels from left of canvas and 100 pixels from top of canvas |
07:20 | repeat 3{turnright 120 forward 100} commands turtle to draws an equilateral triangle on the canvas |
07:32 | Let me run the program to check all the conditions. |
07:36 | Press F5 key to run the code. |
07:40 | Enter 6 for length of AB and click OK |
07:45 | Enter 5 for length of BC and click OK |
07:48 | Enter 7 for length of AC and click OK |
07:54 | “Triangle is not equilateral” is displayed on the canvas. |
07:58 | Let's run again. Let's enter 5 for length of AB and click ok. |
08:05 | 5 for length of BC and click ok. |
08:09 | 5 for length of AC and click OK |
08:13 | “Triangle is equilateral” is displayed on the canvas. An equilateral triangle is drawn on the canvas. |
08:21 | With this we come to the end of this tutorial. |
08:25 | Let's summarize |
08:28 | In this tutorial we have learnt, the question glues and not |
08:35 | As an assignment, I would like you to write program to determine |
08:40 | Angle concept for right angled triangle using question glue “or” |
08:48 | Structure of if or condition is: |
08:51 | if within brackets condition or within brackets condition or within brackets condition. |
08:59 | Within curly brackets do something. |
09:02 | else within curly brackets do something. |
09:06 | Watch the video available at this URLhttp://spoken-tutorial.org/What is a Spoken Tutorial |
09:10 | It summarises the Spoken Tutorial project |
09:13 | If you do not have good bandwidth, you can download and watch it |
09:18 | The Spoken Tutorial Project Team : |
09:20 | Conducts workshops using spoken tutorials |
09:23 | Gives certificates to those who pass an online test |
09:27 | For more details, please write to contact@spoken-tutorial.org |
09:34 | Spoken Tutorial Project is a part of the Talk to a Teacher project. |
09:38 | It is supported by the National Mission on Education through ICT, MHRD, Government of India |
09:44 | More information on this Mission is available at this link http://spoken-tutorial.org/NMEICT-Intro ] |
09:49 | This is Madhuri Ganpathi from IIT Bombay signing off.
Thank you for joining |
Contributors and Content Editors
Devraj, Madhurig, PoojaMoolya, Pratik kamble, Sandhya.np14, Sneha