Difference between revisions of "KTurtle/C3/Programming-Concepts/English-timed"
From Script | Spoken-Tutorial
Sandhya.np14 (Talk | contribs) |
Sandhya.np14 (Talk | contribs) |
||
Line 25: | Line 25: | ||
|- | |- | ||
||00:18 | ||00:18 | ||
− | ||* Use ''' | + | ||* Use '''"print" command''' to print on '''canvas''' |
|- | |- | ||
Line 42: | Line 42: | ||
|- | |- | ||
||00:43 | ||00:43 | ||
− | ||If not, for relevant tutorials, please visit our website: http://spoken-tutorial.org | + | ||If not, for relevant tutorials, please visit our website: |
+ | http://spoken-tutorial.org | ||
|- | |- | ||
||00:49 | ||00:49 | ||
Line 48: | Line 49: | ||
|- | |- | ||
||00:55 | ||00:55 | ||
− | || | + | ||Turtle displayed on the canvas is called "sprite". |
|- | |- | ||
||01:00 | ||01:00 | ||
− | ||"Sprite" is a small image that moves around the screen. e.g. | + | ||"Sprite" is a small image that moves around the screen. e.g. cursor is a sprite. |
|- | |- | ||
||01:10 | ||01:10 | ||
− | || | + | ||"spritehide" command hides '''Turtle''' from canvas. |
|- | |- | ||
||01:15 | ||01:15 | ||
− | || | + | ||"spriteshow" command shows '''Turtle''', if it is hidden. |
|- | |- | ||
||01:21 | ||01:21 | ||
− | || | + | ||"clear" command cleans all drawings from canvas. |
|- | |- | ||
||01:27 | ||01:27 | ||
Line 67: | Line 68: | ||
|- | |- | ||
||01:29 | ||01:29 | ||
− | ||"$" sign is a container of variables. | + | ||"$" (Doller) sign is a container of variables. |
|- | |- | ||
Line 85: | Line 86: | ||
|- | |- | ||
||01:58 | ||01:58 | ||
− | ||Let's open new '''KTurtle | + | ||Let's open new '''KTurtle Application'''. |
|- | |- | ||
||02:02 | ||02:02 | ||
Line 98: | Line 99: | ||
|- | |- | ||
||02:20 | ||02:20 | ||
− | ||We can also open | + | ||We can also open KTurtle using '''terminal'''. |
|- | |- | ||
||02:24 | ||02:24 | ||
− | ||Press '''Ctrl+Alt+T''' simultaneously to open the terminal. | + | ||Press '''Ctrl+Alt+T''' keys simultaneously to open the terminal. |
|- | |- | ||
||02:30 | ||02:30 | ||
− | ||Type ''' | + | ||Type '''kturtle''' and press '''Enter'''. 'KTurtle' Application opens. |
|- | |- | ||
||02:41 | ||02:41 | ||
− | ||Let me type and explain the | + | ||Let me type and explain the program code. |
|- | |- | ||
||02:46 | ||02:46 | ||
Line 128: | Line 129: | ||
|- | |- | ||
||03:30 | ||03:30 | ||
− | ||'''reset''' command sets Turtle to default position. Press '''Enter'''. | + | ||'''reset''' command sets '''Turtle''' to default position. Press '''Enter'''. |
|- | |- | ||
||03:38 | ||03:38 | ||
− | ||'''$i= ask''' within double quotes | + | ||'''$i= ask''' within double quotes "enter a number for i and click OK". |
|- | |- | ||
Line 155: | Line 156: | ||
|- | |- | ||
||04:36 | ||04:36 | ||
− | ||'''print $i*$i''' calculates and prints square of a number. press Enter. | + | ||'''print $i*$i''' calculates and prints square of a number. press '''Enter'''. |
|- | |- | ||
Line 185: | Line 186: | ||
|- | |- | ||
||05:17 | ||05:17 | ||
− | ||Let me '''run''' the code at ''' | + | ||Let me '''run''' the code at '''Slow''' speed. |
|- | |- | ||
||05:21 | ||05:21 | ||
Line 194: | Line 195: | ||
|- | |- | ||
||05:29 | ||05:29 | ||
− | ||Square of '15' = '''225''' is displayed on the canvas. | + | ||Square of '''15''' = '''225''' is displayed on the canvas. |
|- | |- | ||
||05:35 | ||05:35 | ||
Line 200: | Line 201: | ||
|- | |- | ||
||05:42 | ||05:42 | ||
− | ||I already have program in a text editor. | + | ||I already have program in a text-editor. |
|- | |- | ||
|05:46 | |05:46 | ||
Line 228: | Line 229: | ||
|- | |- | ||
||06:31 | ||06:31 | ||
− | ||'''fontsize 28''' sets the font size used by print. | + | ||'''fontsize 28''' sets the font-size used by print. |
|- | |- | ||
||06:37 | ||06:37 | ||
− | || | + | ||'''fontsize''' takes number as input, sets in pixels. |
|- | |- | ||
||06:43 | ||06:43 | ||
Line 240: | Line 241: | ||
|- | |- | ||
||06:57 | ||06:57 | ||
− | ||Let's | + | ||Let's '''run''' the program. |
|- | |- | ||
Line 250: | Line 251: | ||
|- | |- | ||
||07:18 | ||07:18 | ||
− | ||Next, let's use inbuilt | + | ||Next, let's use inbuilt “sqrt” function in a program to find square root of a number. |
|- | |- | ||
||07:27 | ||07:27 | ||
− | ||Let me copy the code from editor and paste it into | + | ||Let me copy the code from text-editor and paste it into KTurtle's editor. |
|- | |- | ||
Line 264: | Line 265: | ||
|- | |- | ||
||07:49 | ||07:49 | ||
− | ||Let me explain the code. | + | ||Let me explain the code now. |
− | + | ||
|- | |- | ||
|| 07:52 | || 07:52 | ||
− | ||'#' sign comments a line written after it. | + | ||'#' hyash sign comments a line written after it. |
|- | |- | ||
||07:57 | ||07:57 | ||
Line 277: | Line 277: | ||
|- | |- | ||
||08:07 | ||08:07 | ||
− | ||'''fontsize 28''' sets the font size used by print. | + | ||'''fontsize 28''' sets the font-size used by '''print'''. |
|- | |- | ||
||08:12 | ||08:12 | ||
Line 293: | Line 293: | ||
||08:34 | ||08:34 | ||
||Square root of 169 = '''13''' is displayed on canvas. | ||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 | ||
Line 302: | Line 301: | ||
|- | |- | ||
||08:49 | ||08:49 | ||
− | ||If we enter negative number, output is | + | ||If we enter a negative number, output is "nan". It means "not a number" |
|- | |- | ||
||08:56 | ||08:56 | ||
− | || | + | ||as square root of a negative number is not a real number. |
|- | |- | ||
||09:02 | ||09:02 | ||
Line 311: | Line 310: | ||
|- | |- | ||
||09:08 | ||09:08 | ||
− | ||Let me copy the program from editor and paste it into | + | ||Let me copy the program from text-editor and paste it into KTurtle's editor. |
|- | |- | ||
Line 324: | Line 323: | ||
|- | |- | ||
||09:35 | ||09:35 | ||
− | ||'#' sign comments a line written after it. | + | ||'#' hyash 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 | ||
Line 339: | Line 338: | ||
|- | |- | ||
||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 | ||
Line 351: | Line 350: | ||
|- | |- | ||
||10:23 | ||10:23 | ||
− | ||Let's '''run''' the program | + | ||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. | + | ||Cube root of 343 = '''7''' is displayed on the canvas. |
|- | |- | ||
||10:40 | ||10:40 | ||
Line 374: | Line 373: | ||
|- | |- | ||
||10:52 | ||10:52 | ||
− | ||* Use of sqrt function | + | ||* Use of "sqrt" function |
|- | |- | ||
||10:55 | ||10:55 | ||
− | ||* Use of print command | + | ||* Use of "print" command |
|- | |- | ||
Line 385: | Line 384: | ||
|- | |- | ||
||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 | ||
Line 419: | Line 418: | ||
|- | |- | ||
||11:35 | ||11:35 | ||
− | ||For more details, please write to contact@spoken-tutorial.org | + | ||For more details, please write to: |
+ | contact@spoken-tutorial.org | ||
|- | |- | ||
||11:44 | ||11:44 |
Revision as of 16:56, 24 February 2016
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: |
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 | "$" (Doller) 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 keys 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 text-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 now. |
07:52 | '#' hyash 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 a negative number, output is "nan". It means "not a number" |
08:56 | as square root of a 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 text-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 | '#' hyash 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 the 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