Difference between revisions of "KTurtle/C3/Programming-Concepts/English-timed"
From Script | Spoken-Tutorial
Line 251: | Line 251: | ||
||07.27 | ||07.27 | ||
||Let me copy the code from editor and paste it into ''' KTurtle's''' editor. | ||Let me copy the code from editor and paste it into ''' KTurtle's''' editor. | ||
− | |||
|- | |- |
Revision as of 12:35, 2 August 2013
Visual Cue | 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,Ubuntu Linux OS Version 11.10. KTurtle version 0.8.1 beta. |
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, set in pixels. |
06.43 | print ($i^$n) calculates & prints nth power of a number. |
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 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 preceeded 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 be 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 URLhttp://spoken-tutorial.org/What is a Spoken Tutorial |
11.19 | It summarises 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 http://spoken-tutorial.org/NMEICT-Intro ]. |
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