Difference between revisions of "KTurtle/C3/Programming-Concepts/English-timed"
From Script | Spoken-Tutorial
Sandhya.np14 (Talk | contribs) |
Sandhya.np14 (Talk | contribs) |
||
Line 231: | Line 231: | ||
|- | |- | ||
||06:37 | ||06:37 | ||
− | ||Fontsize takes number as input, | + | ||Fontsize takes number as input, sets in pixels. |
|- | |- | ||
||06:43 | ||06:43 | ||
− | ||'''print ($i^$n)''' calculates & prints nth power of a number. | + | ||'''print ($i^$n)''' calculates & prints nth power of a number ($i). |
|- | |- | ||
||06:52 | ||06:52 | ||
Line 244: | Line 244: | ||
|- | |- | ||
||07:00 | ||07:00 | ||
− | ||Let's enter | + | ||Let's enter 5 for 'i' and click '''OK''' |
|- | |- | ||
||07:05 | ||07:05 | ||
− | ||Let's enter | + | ||Let's enter 4 for 'n' and click OK. 5^4='''625''' is displayed on the canvas. |
|- | |- | ||
||07:18 | ||07:18 | ||
Line 261: | Line 261: | ||
|- | |- | ||
||07:43 | ||07:43 | ||
− | ||Let me zoom the program text it may possibly be a little blurred. | + | ||Let me zoom the program text, it may possibly be a little blurred. |
|- | |- | ||
||07:49 | ||07:49 | ||
Line 268: | Line 268: | ||
|- | |- | ||
|| 07:52 | || 07:52 | ||
− | ||# sign comments a line written after it . | + | ||'#' sign comments a line written after it. |
|- | |- | ||
||07:57 | ||07:57 | ||
Line 286: | Line 286: | ||
|- | |- | ||
||08:24 | ||08:24 | ||
− | ||Let me run the program now. | + | ||Let me '''run''' the program now. |
|- | |- | ||
||08:28 | ||08:28 | ||
− | ||Let's enter '169' for i | + | ||Let's enter '''169''' for 'i' and click '''OK'''. |
|- | |- | ||
||08:34 | ||08:34 | ||
− | || | + | ||Square root of 169 = '''13''' is displayed on canvas. |
|- | |- | ||
||08:39 | ||08:39 | ||
− | ||Let's run again | + | ||Let's run again. |
|- | |- | ||
||08:42 | ||08:42 | ||
− | || | + | ||Let's enter '''-169''' for 'i' and click '''OK'''. |
|- | |- | ||
||08:49 | ||08:49 | ||
− | ||If we enter negative number, output is ''''nan'''' | + | ||If we enter negative number, output is ''''nan''''. It means "not a number". |
|- | |- | ||
||08:56 | ||08:56 | ||
− | ||As square root of negative number is not | + | ||As square root of negative number is not a real number. |
|- | |- | ||
||09:02 | ||09:02 | ||
− | || | + | || Let's next evaluate cube-root of a positive number through a program. |
|- | |- | ||
||09:08 | ||09:08 | ||
Line 318: | Line 318: | ||
|- | |- | ||
||09:25 | ||09:25 | ||
− | ||Let me zoom into the program text it may possibly be a little blurred. | + | ||Let me zoom into the program text, it may possibly be a little blurred. |
|- | |- | ||
||09:31 | ||09:31 | ||
Line 324: | Line 324: | ||
|- | |- | ||
||09:35 | ||09:35 | ||
− | ||# | + | ||'#' sign comments a line written after it. |
|- | |- | ||
||09:38 | ||09:38 | ||
− | ||Please note this is a single line comment. | + | ||Please note this is a '''single line comment'''. |
|- | |- | ||
||09:42 | ||09:42 | ||
− | ||Every comment must be preceded by a # sign. | + | ||Every comment must be preceded by a '#' sign. |
|- | |- | ||
||09:48 | ||09:48 | ||
Line 339: | Line 339: | ||
|- | |- | ||
||09:59 | ||09:59 | ||
− | ||'''$C=($i)^(1/3)''' calculates cube root of a number. | + | ||'''$C=($i)^(1/3)''' calculates cube-root of a number. |
|- | |- | ||
||10:07 | ||10:07 | ||
− | ||'''fontsize 28''' sets the font size used by print. | + | ||'''fontsize 28''' sets the font-size used by print. |
|- | |- | ||
||10:13 | ||10:13 | ||
− | ||'''print $C''' prints cube root of a number. | + | ||'''print $C''' prints cube-root of a number. |
|- | |- | ||
||10:19 | ||10:19 | ||
Line 351: | Line 351: | ||
|- | |- | ||
||10:23 | ||10:23 | ||
− | ||Let's | + | ||Let's '''run''' the program |
|- | |- | ||
||10:27 | ||10:27 | ||
− | ||Let's enter 343 for i and click OK | + | ||Let's enter 343 for 'i' and click '''OK''' |
|- | |- | ||
||10:34 | ||10:34 | ||
− | || | + | ||Cube root of 343 = '''7''' is displayed on canvas. |
|- | |- | ||
||10:40 | ||10:40 | ||
− | ||With this we come to the end of this tutorial. | + | ||With this, we come to the end of this tutorial. |
|- | |- | ||
||10:43 | ||10:43 | ||
− | || | + | ||Let us summarize. |
|- | |- | ||
||10:46 | ||10:46 | ||
− | ||In this tutorial, we have learnt | + | ||In this tutorial, we have learnt: |
|- | |- | ||
||10:49 | ||10:49 | ||
− | ||Programming concepts | + | ||* Programming concepts |
|- | |- | ||
||10:52 | ||10:52 | ||
− | || Use of sqrt function | + | ||* Use of sqrt function |
|- | |- | ||
||10:55 | ||10:55 | ||
− | || Use of print command | + | ||* Use of print command |
|- | |- | ||
||10:57 | ||10:57 | ||
− | ||Using KTurtle editor and canvas. | + | ||* Using KTurtle editor and canvas. |
|- | |- | ||
||11:02 | ||11:02 | ||
− | ||As an assignment, I would like you to use basic programming commands to find | + | ||As an assignment, I would like you to use basic programming commands to find= |
|- | |- | ||
||11:08 | ||11:08 | ||
− | ||Cube of a number | + | ||* Cube of a number |
|- | |- | ||
||11:11 | ||11:11 | ||
− | || nth root of a number | + | ||* nth root of a number. |
|- | |- | ||
||11:15 | ||11:15 | ||
− | ||Watch the video available at | + | ||Watch the video available at this URL: |
+ | http://spoken-tutorial.org/What_is_a_Spoken-Tutorial | ||
|- | |- | ||
||11:19 | ||11:19 | ||
− | ||It | + | ||It summarizes the Spoken Tutorial project. |
|- | |- | ||
||11:22 | ||11:22 | ||
− | ||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. |
|- | |- | ||
||11:27 | ||11:27 | ||
− | ||The Spoken Tutorial Project | + | ||The Spoken Tutorial Project team: |
|- | |- | ||
||11:29 | ||11:29 | ||
− | ||Conducts workshops using spoken tutorials | + | ||* Conducts workshops using spoken tutorials. |
|- | |- | ||
||11:32 | ||11:32 | ||
− | ||Gives certificates to those who pass an online test | + | ||* Gives certificates to those who pass an online test. |
|- | |- | ||
Line 421: | Line 422: | ||
|- | |- | ||
||11:44 | ||11:44 | ||
− | ||Spoken Tutorial | + | ||'''Spoken Tutorial''' project is a part of the '''Talk to a Teacher''' project. |
|- | |- | ||
Line 428: | Line 429: | ||
|- | |- | ||
||11:55 | ||11:55 | ||
− | ||More information on this | + | ||More information on this mission is available at this link: |
+ | http://spoken-tutorial.org/NMEICT-Intro | ||
|- | |- | ||
||11:59 | ||11:59 | ||
− | ||This is Madhuri Ganpathi | + | ||This is Madhuri Ganpathi from '''IIT Bombay''', signing off. Thank you for joining. |
|- | |- |
Revision as of 16:40, 18 September 2015
Time | Narration |
00:01 | Hello Everybody. |
00:03 | Welcome to this tutorial on Programming concepts in KTurtle. |
00:08 | In this tutorial, we will learn how to: |
00:12 | * Write a program in 'KTurtle' |
00:15 | * Use variables to store user input |
00:18 | * Use 'print' command to print on canvas |
00:22 | * Comment a line. |
00:24 | To record this tutorial, I am using:
|
00:37 | We assume that you have basic working knowledge of KTurtle. |
00:43 | If not, for relevant tutorials, please visit our website: http://spoken-tutorial.org |
00:49 | Before proceeding, we will discuss some basic information about KTurtle. |
00:55 | "Turtle" displayed on the canvas is called "sprite". |
01:00 | "Sprite" is a small image that moves around the screen. e.g. Cursor is a sprite. |
01:10 | "spritehide" command hides Turtle from canvas. |
01:15 | "spriteshow" command shows Turtle, if it is hidden. |
01:21 | "clear" command cleans all drawings from canvas. |
01:27 | In KTurtle, |
01:29 | "$" sign is a container of variables. |
01:34 | "*" (asterisk) is used for multiplication of two numbers. |
01:41 | "^" (caret) raises a power of the number. |
01:45 | "#" (hash) sign comments a line written after it. |
01:50 | "sqrt" is an inbuilt function to find square root of a number. |
01:58 | Let's open new KTurtle Application. |
02:02 | Click on Dash home >> Media Apps. |
02:07 | Under Type, choose Education and KTurtle. |
02:13 | KTurtle application opens. |
02:20 | We can also open KTurtle using terminal. |
02:24 | Press Ctrl+Alt+T simultaneously to open the terminal. |
02:30 | Type KTurtle and press Enter, 'KTurtle' Application opens. |
02:41 | Let me type and explain the program code. |
02:46 | Let me zoom into the program text, it may possibly be a little blurred. |
02:55 | #program to find square of a number. Press Enter. |
03:15 | "#" sign comments a line written after it. |
03:19 | This means, this line will not be executed while running the program. Press Enter. |
03:29 | reset |
03:30 | reset command sets Turtle to default position. Press Enter. |
03:38 | $i= ask within double quotes enter a number for i and click OK. |
03:58 | "$i" is a variable to store user input. |
04:03 | “ask” command asks for user input to be stored in variable. Press Enter. |
04:11 | “fontsize” space 28. |
04:17 | fontsize sets the font-size used by print. |
04:20 | fontsize takes number as input, set in pixels. |
04:27 | print $i*$i |
04:36 | print $i*$i calculates and prints square of a number. press Enter. |
04:45 | spritehide |
04:48 | spritehide hides Turtle from canvas. |
04:53 | Let us run the program now. |
04:56 | Click on the Run button on the toolbar to start execution of the code in the editor. |
05:03 | It shows a list of execution speeds. |
05:07 | Full speed (no highlighting and inspector) |
05:10 | Full speed,
slow, slower, slowest and step-by-step. |
05:17 | Let me run the code at slow speed. |
05:21 | An input bar appears. |
05:23 | Let's enter 15 for 'i' and click OK. |
05:29 | Square of '15' = 225 is displayed on the canvas. |
05:35 | Let's now learn to find nth power of a number through a program. |
05:42 | I already have program in a text editor. |
05:46 | Let me copy the program from text editor and paste it into KTurtle editor. |
05:56 | Please pause the tutorial here and copy the program into your KTurtle editor. |
06:03 | Let me zoom into the program text. |
06:07 | Explain the program. |
06:09 | # sign comments a line written after it. |
06:13 | reset command sets Turtle to default position. |
06:18 | $i and $n are variables to store user input. |
06:25 | “ask” command asks for user input to be stored in variables. |
06:31 | fontsize 28 sets the font size used by print. |
06:37 | Fontsize takes number as input, sets in pixels. |
06:43 | print ($i^$n) calculates & prints nth power of a number ($i). |
06:52 | spritehide hides Turtle from canvas. |
06:57 | Let's run the program. |
07:00 | Let's enter 5 for 'i' and click OK |
07:05 | Let's enter 4 for 'n' and click OK. 5^4=625 is displayed on the canvas. |
07:18 | Next, let's use inbuilt “sqrt” function in a program to find square root of a number. |
07:27 | Let me copy the code from editor and paste it into KTurtle's editor. |
07:35 | Please pause the tutorial here and copy the program into your KTurtle editor. |
07:43 | Let me zoom the program text, it may possibly be a little blurred. |
07:49 | Let me explain the code. |
07:52 | '#' sign comments a line written after it. |
07:57 | reset command sets Turtle to default position. |
08:02 | $i is a variable to store user input. |
08:07 | fontsize 28 sets the font size used by print. |
08:12 | print sqrt $i prints square root of a number. |
08:19 | spritehide hides Turtle from canvas. |
08:24 | Let me run the program now. |
08:28 | Let's enter 169 for 'i' and click OK. |
08:34 | Square root of 169 = 13 is displayed on canvas. |
08:39 | Let's run again. |
08:42 | Let's enter -169 for 'i' and click OK. |
08:49 | If we enter negative number, output is 'nan'. It means "not a number". |
08:56 | As square root of negative number is not a real number. |
09:02 | Let's next evaluate cube-root of a positive number through a program. |
09:08 | Let me copy the program from editor and paste it into KTurtle's editor. |
09:19 | Please pause the tutorial here and copy the program into your KTurtle editor. |
09:25 | Let me zoom into the program text, it may possibly be a little blurred. |
09:31 | Let me explain the program. |
09:35 | '#' sign comments a line written after it. |
09:38 | Please note this is a single line comment. |
09:42 | Every comment must be preceded by a '#' sign. |
09:48 | reset command sets the Turtle to default position. |
09:53 | $i and $C are variables to store user input. |
09:59 | $C=($i)^(1/3) calculates cube-root of a number. |
10:07 | fontsize 28 sets the font-size used by print. |
10:13 | print $C prints cube-root of a number. |
10:19 | spritehide hides Turtle from canvas. |
10:23 | Let's run the program |
10:27 | Let's enter 343 for 'i' and click OK |
10:34 | Cube root of 343 = 7 is displayed on canvas. |
10:40 | With this, we come to the end of this tutorial. |
10:43 | Let us summarize. |
10:46 | In this tutorial, we have learnt: |
10:49 | * Programming concepts |
10:52 | * Use of sqrt function |
10:55 | * Use of print command |
10:57 | * Using KTurtle editor and canvas. |
11:02 | As an assignment, I would like you to use basic programming commands to find= |
11:08 | * Cube of a number |
11:11 | * nth root of a number. |
11:15 | Watch the video available at this URL: |
11:19 | It summarizes the Spoken Tutorial project. |
11:22 | If you do not have good bandwidth, you can download and watch it. |
11:27 | The Spoken Tutorial Project team: |
11:29 | * Conducts workshops using spoken tutorials. |
11:32 | * Gives certificates to those who pass an online test. |
11:35 | For more details, please write to contact@spoken-tutorial.org |
11:44 | Spoken Tutorial project is a part of the Talk to a Teacher project. |
11:48 | It is supported by the National Mission on Education through ICT, MHRD, Government of India. |
11:55 | More information on this mission is available at this link: |
11:59 | This is Madhuri Ganpathi from IIT Bombay, signing off. Thank you for joining. |
Contributors and Content Editors
Kaushik Datta, Madhurig, PoojaMoolya, Pratik kamble, Sandhya.np14, Sneha