Difference between revisions of "KTurtle/C3/Common-Errors-in-KTurtle/English-timed"

From Script | Spoken-Tutorial
Jump to: navigation, search
 
(5 intermediate revisions by 3 users not shown)
Line 1: Line 1:
 
{|border =1
 
{|border =1
 
|'''Time'''
 
|'''Time'''
|'''Narration''';
+
|'''Narration'''
 +
 
 
|-
 
|-
|| 00:01
+
|00:01
|| Welcome to this tutorial on '''Common Errors'''  in '''KTurtle.'''
+
|Welcome to this tutorial on '''Common Errors in KTurtle.'''
 +
 
 
|-
 
|-
|| 00:07
+
|00:07
||In this tutorial, we will learn about
+
|In this tutorial, we will learn about:
 +
 
 
|-
 
|-
|| 00:10
+
|00:10
|| '''Syntax errors'''   
+
|'''Syntax errors'''   
  
 
|-
 
|-
|| 00:12
+
|00:12
|| '''Runtime errors'''  and
+
|'''Run time errors'''  and
  
 
|-
 
|-
|| 00:14
+
|00:14
|| '''Logical errors'''
+
|'''Logical errors'''.
 +
 
 
|-
 
|-
|| 00:17
+
|00:17
||To record this tutorial I am using,
+
|To record this tutorial, I am using:
  
 
|-
 
|-
||00:20
+
|00:20
|'''Ubuntu''' '''Linux''' OS version 12.04.
+
|'''Ubuntu Linux OS''' version '''12.04'''  
  
 
|-
 
|-
|| 00:25
+
|00:25
|'''KTurtle''' version. 0.8.1 beta.
+
|'''KTurtle''' version '''0.8.1 beta'''.
 +
 
 
|-
 
|-
|| 00:31
+
|00:31
||We assume that you have basic working knowledge of '''KTurtle'''   
+
|We assume that you have basic working knowledge of '''KTurtle'''.  
  
 
|-
 
|-
|| 00:36
+
|00:36
|If not,  for relevant tutorials, please visit our website.  
+
|If not,  for relevant tutorials, please visit our website:
 +
http://spoken-tutorial.org'''
  
'''http://spoken-tutorial.org'''
 
 
|-
 
|-
|| 00:42
+
|00:42
||Let's first defineWhat is an error ?
+
|Let's first define- What is an '''error'''?
  
 
|-
 
|-
|| 00:46
+
|00:46
|'''Error''' is a mistake in a program that produces an '''incorrect''' or '''unexpected''' result.
+
|'''Error''' is a mistake in a program that produces an incorrect or unexpected result.
 +
 
 
|-
 
|-
||00:55
+
|00:55
||First I will explain about '''"Types of errors".'''
+
|First, I will explain about types of '''errors.'''
 +
 
 
|-
 
|-
|| 01:00
+
|01:00
|| '''Syntax error''' is a '''violation of  grammatical rules''', of a '''programming language'''.
+
|'''Syntax error''' is a violation of  grammatical rules of a programming language.
  
 
|-
 
|-
|| 01:09
+
|01:09
 
|'''Compilation''' fails when a program has '''syntax errors'''.
 
|'''Compilation''' fails when a program has '''syntax errors'''.
  
 
|-
 
|-
|| 01:15
+
|01:15
 
|'''Syntax errors''' are easy to find and fix.
 
|'''Syntax errors''' are easy to find and fix.
  
 
|-
 
|-
|| 01:22
+
|01:22
|For Example:
+
|For Example:,Unmatched parentheses, square and curly braces.
  
 
|-
 
|-
|| 01:23
+
|01:29
|| '''Unmatched parentheses''', '''square  ''' and '''curly braces'''.  
+
|Use of ''' variable''' that has not been declared.
  
 
|-
 
|-
|| 01:29
+
|01:34
|| Use of ''' variable''' that has not been '''declared'''.
+
|Missing '''quotes''' in '''strings.'''
  
 
|-
 
|-
|| 01:34
+
|01:38
|| Missing '''quotes''' in '''strings.'''
+
|Let's open a new '''KTurtle''' '''Application'''.
|-
+
|| 01:38
+
||Let's open a new '''KTurtle''' Application.
+
  
 
|-
 
|-
|| 01:42
+
|01:42
|Click on  '''Dash  home'''. In the Search bar, type '''KTurtle.'''
+
|Click on  '''Dash  home'''. In the '''Search bar''', type: "kturtle".
  
 
|-
 
|-
|| 01:48
+
|01:48
 
|Click on the  '''KTurtle''' icon.
 
|Click on the  '''KTurtle''' icon.
 +
 
|-
 
|-
||01:51
+
|01:51
||Let's begin the tutorial with some types of''' syntax errors'''.
+
|Let's begin the tutorial with some types of''' syntax errors'''.
 +
 
 
|-
 
|-
||01:58
+
|01:58
||I already have a program in a text editor.  
+
|I already have a program in a text-editor.  
 +
 
 
|-
 
|-
|| 02:02
+
|02:02
||To explain the '''error''' in the program, I will comment part of the code.  
+
|To explain the '''error''' in the program, I will '''comment''' part of the '''code'''.  
 +
 
 
|-
 
|-
|| 02:09
+
|02:09
||Here, I will comment the line  
+
|Here, I will '''comment''' the line.
  
 
|-
 
|-
|| 02:11
+
|02:11
||'''$a=ask within double quotes "enter any number and click Ok"'''
+
|'''$a=ask''' within double quotes "enter any number and click Ok".
 +
 
 
|-
 
|-
||02:19
+
|02:19
||I will use '''hash(#)''' sign to comment the line.
+
|I will use hash(#) sign to '''comment''' the line.
 +
 
 
|-
 
|-
|| 02:23
+
|02:23
||I will copy the program from text editor and paste it into '''Kturtle's''' Editor.
+
|I will copy the program from text-editor and paste it into Kturtle's editor.
  
 
|-
 
|-
|| 02:31
+
|02:31
|Pause the tutorial here and type the program into  your '''KTurtle''' editor  
+
|Pause the tutorial here and type the program into  your '''KTurtle''' editor.
  
 
|-
 
|-
|| 02:37
+
|02:37
 
|Resume the tutorial after typing the program.
 
|Resume the tutorial after typing the program.
 +
 
|-
 
|-
|| 02:42
+
|02:42
||Let's click on '''Run''' button to run the program  
+
|Let's click on '''Run''' button to '''run''' the program.
  
 
|-
 
|-
|| 02:47
+
|02:47
|'''Compiler''' shows the following error,
+
|Compiler shows the following error:
  
 
|-
 
|-
|| 02:50
+
|02:50
|''' variable "$a" was used without first being assigned  to a value.'''
+
|"variable '$a' was used without first being assigned  to a value".
 +
 
 
|-
 
|-
|| 02:57
+
|02:57
||Here the error is in line number 4.
+
|Here, the error is in line number 4.
  
 
|-
 
|-
||03:02
+
|03:02
||This is a '''syntax error'''. It occured, as the variable  'a' was not declared.
+
|This is a '''syntax error'''. It occurred as the variable  'a' was not declared.
 +
 
 
|-
 
|-
|| 03:10
+
|03:10
||So I will go to line number 2, remove the comment.
+
|So, I will go to line number 2, remove the '''comment'''.
 +
 
 
|-
 
|-
|03:14
+
|03:14
|| I will copy the program from text Editor and paste it into''' KTurtle's editor'''.
+
|I will copy the program from text-editor and paste it into KTurtle's editor.
 +
 
 
|-
 
|-
|| 03:23
+
|03:23
||Let's click on '''Run''' button to run the program  
+
|Let's click on '''Run''' button to '''run''' the program.
  
 
|-
 
|-
|| 03:27
+
|03:27
|Enter '''6''' for '''a''' value and click OK
+
|Enter '6' for 'a' value and click '''OK'''.
  
 
|-
 
|-
|| 03:31
+
|03:31
 
|Program runs without errors.  
 
|Program runs without errors.  
 +
 
|-
 
|-
|| 03:35
+
|03:35
||I will clear the current program from '''KTurtle''' editor.
+
|I will clear the current program from '''KTurtle''' editor.
  
 
|-
 
|-
|| 03:38
+
|03:38
|Type '''clear''' command and '''Run''' to clean the canvas.
+
|Type "clear" command and '''Run''' to clean the canvas.
 +
 
 
|-
 
|-
||03:43
+
|03:43
|| let's next look at another error.
+
|Let's next look at another error.
 +
 
 
|-
 
|-
||03:46
+
|03:46
||I already have a program in a text editor.  
+
|I already have a program in a text-editor.  
 +
 
 
|-
 
|-
|| 03:50
+
|03:50
||Here the value of "'''pi'''" is '''predefined''' in KTurtle.
+
|Here, the value of "pi" is predefined in KTurtle.
 +
 
 
|-
 
|-
|| 03:54
+
|03:54
||Let's delete the "'''$'''" sign in the program.  
+
|Let's delete the '$' sign in the program.  
 +
 
 
|-
 
|-
|03:58
+
|03:58
||I will copy the program from text editor and paste it into ''' Kturtle's Editor'''
+
|I will copy the program from text editor and paste it into Kturtle's Editor.
  
 
|-
 
|-
|| 04:05
+
|04:05
|Pause the tutorial here and type the program into your  '''KTurtle editor'''
+
|Pause the tutorial here and type the program into your  KTurtle editor.
 
+
  
 
|-
 
|-
|| 04:11
+
|04:11
 
|Resume the tutorial after typing the program.
 
|Resume the tutorial after typing the program.
 +
 
|-
 
|-
|| 04:16
+
|04:16
||Let's Click on '''Run''' button to run the program.  
+
|Let's click on '''Run''' button to '''run''' the program.  
  
 
|-
 
|-
|| 04:19
+
|04:19
|'''Complier''' shows the following error,
+
|Complier shows the following error:
  
 
|-
 
|-
|| 04:22
+
|04:22
|'''you cannot put =here'''
+
|"You cannot put '=' here".
 +
 
 
|-
 
|-
|| 04:26
+
|04:26
||This error is in line number 2.  
+
|This error is in line number 2.  
 +
 
 
|-
 
|-
|| 04:30
+
|04:30
||This is a '''syntax error''' it occured, as there is no '''container  of variable.'''
+
|This is a syntax error. It occurred as there is no '''container''' of variable.
 +
 
 
|-
 
|-
|| 04:37
+
|04:37
||Let's go back to the program replace the $ sign.
+
|Let's go back to the program, replace the '$' sign.
 +
 
 
|-
 
|-
|04:41
+
|04:41
||I will copy the program from text editor and paste it into '''KTurtle's''' Editor
+
|I will copy the program from text editor and paste it into KTurtle's editor.
 +
 
 
|-
 
|-
||04:49
+
|04:49
||let's click on '''Run''' button to run the program.
+
|Let's click on '''Run''' button to '''run''' the program.
  
 
|-
 
|-
|| 04:53
+
|04:53
|Enter '''45''' for angle value and click '''OK'''
+
|Enter 45 for angle value and click '''OK'''.
  
 
|-
 
|-
|| 04:57
+
|04:57
 
|Program runs without errors.
 
|Program runs without errors.
 +
 
|-
 
|-
|| 05:00
+
|05:00
||Let's remove one of the quotes of the string.  
+
|Let's remove one of the quotes of the '''string'''.  
 +
 
 
|-
 
|-
||05:05
+
|05:05
|| I will Copy the program from text editor and paste it into '''KTurtle's ''' Editor
+
|I will copy the program from text editor and paste it into KTurtle's editor.
 +
 
 
|-
 
|-
|| 05:12
+
|05:12
||Click on  '''Run''' button to run the program
+
|Click on  '''Run''' button to '''run''' the program.
  
 
|-
 
|-
|| 05:15
+
|05:15
|'''Complier''' shows the following error,
+
|Complier shows the following error:
  
 
|-
 
|-
|| 05:18
+
|05:18
|'''Text string was not properly closed, expected a double quote “ ” to close the string.'''
+
|'Text string was not properly closed, expected a double quote (") to close the string'.
 +
 
 
|-
 
|-
|| 05:25
+
|05:25
||Here the error is in line number 2.  
+
|Here, the error is in line number 2.  
 +
 
 
|-
 
|-
||05:29
+
|05:29
|| I will  go  back to line number 2 and replace the quotes.  
+
|I will  go  back to line number 2 and replace the quotes.  
 +
 
 
|-
 
|-
|05:34
+
|05:34
||I will copy the program from text editor and paste it into''' Kturtle's''' Editor
+
|I will copy the program from text editor and paste it into Kturtle's editor.
 +
 
 
|-
 
|-
|| 05:41
+
|05:41
||Click on '''Run''' button to run the program
+
|Click on '''Run''' button to run the program.
  
 
|-
 
|-
|| 05:44
+
|05:44
||Enter '''45''' for angle value and click OK.
+
|Enter '45' for angle value and click '''OK'''.
  
 
|-
 
|-
|| 05:49
+
|05:49
 
|Program runs without errors.  
 
|Program runs without errors.  
  
 
|-
 
|-
|| 05:52
+
|05:52
|This way you can find the line at which error has occured, and also correct it.  
+
|This way you can find the line at which error has occurred and also correct it.  
 +
 
 
|-
 
|-
||05:59
+
|05:59
||Let's now learn about runtime errors.
+
|Let's now learn about '''run time''' errors.
 +
 
 
|-
 
|-
|| 06:04
+
|06:04
||'''Run-time error''' occurs during the '''execution''' of a program.  
+
|'''Run-time error''' occurs during the '''execution''' of a program.  
  
 
|-
 
|-
|| 06:10
+
|06:10
|It may '''crash''' the program when you run it.  
+
|It may '''crash''' the program when you '''run''' it.  
  
 
|-
 
|-
|| 06:15
+
|06:15
|'''Runtime errors''' are commonly due to wrong input from the user.  
+
|'''Runtime errors''' are commonly due to wrong '''input''' from the user.  
  
 
|-
 
|-
|| 06:23
+
|06:23
|'''Compiler''' cannnot find these '''errors'''.
+
|Compiler cannot find these '''errors'''.
  
 
|-
 
|-
|| 06:27
+
|06:27
 
|For example:
 
|For example:
 +
 
|-
 
|-
|| 06:29
+
|06:29
 
|Trying to divide by a '''variable''' that contains no value.
 
|Trying to divide by a '''variable''' that contains no value.
  
 
|-
 
|-
|| 06:3
+
|06:31
| Run a loop without a '''terminating condition''' or '''increment value'''.
+
|Run a '''loop''' without a terminating '''condition''' or '''increment value'''.
 +
 
 
|-
 
|-
||06:43
+
|06:43
||I will clear the current program from the editor.
+
|I will clear the current program from the editor.
  
 
|-
 
|-
|| 06:47
+
|06:47
|Type '''clear''' command and '''Run''' to clean the canvas.
+
|Type "clear" command and '''Run''' to clean the canvas.
 +
 
 
|-
 
|-
|| 06:52
+
|06:52
||I already have a program in a text editor.  
+
|I already have a program in a text editor.  
  
 
|-
 
|-
|| 06:56
+
|06:56
|This program '''divides''' two numbers.
+
|This program divides two numbers.
  
 
|-
 
|-
|| 07:00
+
|07:00
 
|'a' is''' dividend''' and 'r' is '''divisor'''.  
 
|'a' is''' dividend''' and 'r' is '''divisor'''.  
 +
 
|-
 
|-
||07:04   
+
|07:04   
||I will copy the program from text editor and paste it into '''KTurtle's''' Editor.  
+
|I will copy the program from text editor and paste it into KTurtle's editor.  
  
 
|-
 
|-
|| 07:11
+
|07:11
|Pause the tutorial and type the program into your '''KTurtle''' editor  
+
|Pause the tutorial here and type the program into your KTurtle editor.
  
 
|-
 
|-
|| 07:16
+
|07:16
 
|Resume the tutorial after typing the program.  
 
|Resume the tutorial after typing the program.  
 +
 
|-
 
|-
|| 07:20
+
|07:20
||Let us click on  '''Run''' button to run the program.  
+
|Let us click on  '''Run''' button to '''run''' the program.  
  
 
|-
 
|-
|| 07:24
+
|07:24
|let's enter '''5''' for 'a' and click OK
+
|Let's enter '5' for 'a' and click '''OK''',
  
 
|-
 
|-
|| 07:29
+
|07:29
|enter '''0''' for 'r' and click OK
+
|enter '0' for 'r' and click '''OK'''.
  
 
|-
 
|-
|| 07:33
+
|07:33
|Here we get a ''' runtime error''' ,
+
|Here, we get a ''' run time error:'''  
  
 
|-
 
|-
|| 07:36
+
|07:36
|“'''you tried to divide by zero'''”
+
|“you tried to divide by zero”.
 +
 
 
|-
 
|-
|| 07:39
+
|07:39
||This error is in line number 4.
+
|This error is in line number 4.
 +
 
 
|-
 
|-
|| 07:43
+
|07:43
||This error occurs as we cannot '''divide''' a number with''' zero'''.
+
|This error occurs as we cannot divide a number with zero.
 +
 
 
|-
 
|-
|| 07:49
+
|07:49
||Let us run   again.  
+
|Let us '''run''' again.  
  
 
|-
 
|-
|| 07:51
+
|07:51
|Enter '''5''' for '''a''' and click OK
+
|Enter '5' for 'a' and click '''OK''',
  
 
|-
 
|-
|| 07:54
+
|07:54
|enter '''2''' for 'r' and click OK  
+
|enter '2' for 'r' and click '''OK'''.
  
 
|-
 
|-
|| 07:58
+
|07:58
 
|Program runs without errors.
 
|Program runs without errors.
 +
 
|-
 
|-
|| 08:01
+
|08:01
||I will clear the current program from '''KTurtle''' editor.
+
|I will clear the current program from KTurtle editor.
  
 
|-
 
|-
|| 08:05
+
|08:05
|Type '''clear''' command and '''Run''' to clean the canvas.
+
|Type "clear" command and '''Run''' to clean the canvas.
 +
 
 
|-
 
|-
||08:10
+
|08:10
||Next we will learn about ''' logical errors'''.
+
|Next, we will learn about ''' logical errors'''.
 +
 
 
|-
 
|-
|| 08:14
+
|08:14
||'''Logical error''' is a mistake in a program's '''source code''' that results in '''incorrect''' or '''unexpected''' behavior.
+
|'''Logical error''' is a mistake in a program's '''source code''' that results in incorrect or unexpected behavior.
  
 
|-
 
|-
|| 08:26
+
|08:26
|For example,
+
|For example-
  
 
|-
 
|-
|| 08:28
+
|08:28
|'''Assigning''' a value to the wrong variable.
+
|Assigning a value to a wrong variable.
  
 
|-
 
|-
|| 08:32
+
|08:32
|'''Multiplying''' two numbers instead of '''adding'''.
+
|Multiplying two numbers instead of adding.
 +
 
 
|-
 
|-
||08:36
+
|08:36
||I already have a program in a text editor.  
+
|I already have a program in a text editor.  
 +
 
 
|-
 
|-
|08:39
+
|08:39
||I will copy the program from text editor and paste it into '''Kturtle's''' Editor
+
|I will copy the program from text editor and paste it into Kturtle's editor.
  
 
|-
 
|-
|| 08:47
+
|08:47
|Pause the tutorial here and type the program into your '''KTurtle''' editor  
+
|Pause the tutorial here and type the program into your KTurtle editor.
  
 
|-
 
|-
|| 08:52
+
|08:52
 
|Resume the tutorial after typing the program.  
 
|Resume the tutorial after typing the program.  
 +
 
|-
 
|-
|| 08:57
+
|08:57
||Now click on the '''Run''' button to run the program.  
+
|Now click on the '''Run''' button to '''run''' the program.  
  
 
|-
 
|-
|| 09:01
+
|09:01
||A dialog box pops-up, let's click OK.
+
|A dialog-box pops-up; let's click '''OK'''.
  
 
|-
 
|-
|| 09:05
+
|09:05
||Loop goes into an '''infinite loop'''.  
+
|Loop goes into an '''infinite loop'''.  
 +
 
 
|-
 
|-
|09:08
+
|09:08
||We see that '''“while”''' loop prints numbers from 31 and is still printing.
+
|We see that “while” loop prints numbers from 31 and is still printing.
  
 
|-
 
|-
|| 09:15
+
|09:15
||This is a '''logical error'''.
+
|This is a '''logical error'''.
  
 
|-
 
|-
|| 09:18
+
|09:18
||In the “while” condition x is greater than 20,
+
|In the “while” condition 'x' is greater than 20
  
 
|-
 
|-
|| 09:23
+
|09:23
||but the '''variable''' x is always greater than 20
+
|but the variable 'x' is always greater than 20.
  
 
|-
 
|-
|| 09:28
+
|09:28
||So, the loop never '''terminates.'''
+
|So, the loop never terminates.
 +
 
 
|-
 
|-
|| 09:31
+
|09:31
||I will click on '''Abort''' button to abort the process.  
+
|I will click on '''Abort''' button to abort the process.  
 +
 
 
|-
 
|-
|| 09:36
+
|09:36
||Let's change $x=$x+1 to $x=$x-1.  
+
|Let's change $x=$x+1 to $x=$x-1.  
 +
 
 
|-
 
|-
||09:44
+
|09:44
|| I will copy the program from text editor and paste it into '''KTurtle's''' editor.
+
|I will copy the program from text editor and paste it into KTurtle's editor.
 +
 
 
|-  
 
|-  
|| 09:51
+
|09:51
||Let's click on '''Run''' button to run the program.  
+
|Let's click on '''Run''' button to run the program.  
  
 
|-
 
|-
|| 09:55
+
|09:55
||A dialog box pop-up. Let us click OK.
+
|A dialog-box pops up. Let us click '''OK'''.
  
 
|-
 
|-
|| 09:59
+
|09:59
||Loop '''terminates''' after printing the values from''' 29 to 20.'''
+
|Loop terminates after printing the values from 29 to 20.  
 +
 
 
|-
 
|-
||10:05
+
|10:05
||With this we   come to the end of this tutorial.
+
|With this, we come to the end of this tutorial.
  
 
|-
 
|-
|| 10:10
+
|10:10
||Let us summarise.
+
|Let us summarize.
 +
 
 
|-
 
|-
|| 10:12
+
|10:12
||In this tutorial we have learnt, errors and types of errors such as
+
|In this tutorial, we have learnt errors and types of errors such as-
  
 
|-
 
|-
|| 10:18
+
|10:18
| Use of '''variable''' that has not been declared.
+
|Use of variable that has not been declared.
  
 
|-
 
|-
|| 10:23
+
|10:23
|Missing '''quotes''' in strings.
+
|Missing '''quotes''' in '''string'''s.
  
 
|-
 
|-
|| 10:27
+
|10:27
|''' Runtime errors''' and
+
|''Runtime errors''' and
  
 
|-
 
|-
|| 10:30
+
|10:30
|| '''Logical errors'''
+
|'''Logical errors'''.As an assignment, I would like you to find errors in the given programs.
|-
+
|| 10:3
+
||As an assignment I would like you to find errors in the given programs
+
 
   
 
   
 
|-
 
|-
 
||10:46
 
||10:46
||Watch the video available at this URl: http://spoken-tutorial.org/What is a Spoken Tutorial  
+
||Watch the video available at this URl:
 +
http://spoken-tutorial.org/What_is_a_Spoken-Tutorial  
 +
 
 
|-
 
|-
|| 10:50
+
|10:50
|It summarises the Spoken Tutorial project  
+
|It summarizes the Spoken Tutorial project.
 +
 
 
|-
 
|-
|| 10:54
+
|10:54
|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:59
+
|10:59
||The Spoken Tutorial Project Team :
+
|The Spoken Tutorial Project team :Conducts workshops using spoken tutorials.
  
 
|-
 
|-
|| 11:01
+
|11:05
|Conducts workshops using spoken tutorials
+
|Gives certificates to those who pass an online test.
 +
 
 
|-
 
|-
|| 11:05
+
|11:09
|Gives certificates to those who pass an online test
+
|For more details, please write to:
|-
+
contact@spoken-tutorial.org
|| 11:09
+
 
|For more details, please write to contact@spoken-tutorial.org
+
 
|-
 
|-
|| 11: 17
+
|11:17
||Spoken Tutorial Project is a part of the Talk to a Teacher project  
+
|'''Spoken Tutorial''' project is a part of the '''Talk to a Teacher''' project.
  
 
|-
 
|-
|| 11:23
+
|11:23
|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.
 
   
 
   
 
|-  
 
|-  
||11:31
+
|11:31
||More information on this Mission is available at this link http://spoken-tutorial.org/NMEICT-Intro ]
+
|More information on this mission is available at this link:
 +
http://spoken-tutorial.org/NMEICT-Intro.
  
 
|-
 
|-
||11:37
+
|11:37
||This is Madhuri Ganpathi from IIT Bombay.Signing off
+
|This is Madhuri Ganpathi from '''IIT Bombay''', signing off.  
 +
 
 
|-
 
|-
||11:41  
+
|11:41  
||Thank you  for joining
+
|Thank you  for joining.

Latest revision as of 18:39, 24 March 2017

Time Narration
00:01 Welcome to this tutorial on Common Errors in KTurtle.
00:07 In this tutorial, we will learn about:
00:10 Syntax errors
00:12 Run time errors and
00:14 Logical errors.
00:17 To record this tutorial, I am using:
00:20 Ubuntu Linux OS version 12.04
00:25 KTurtle version 0.8.1 beta.
00:31 We assume that you have basic working knowledge of KTurtle.
00:36 If not, for relevant tutorials, please visit our website:

http://spoken-tutorial.org

00:42 Let's first define- What is an error?
00:46 Error is a mistake in a program that produces an incorrect or unexpected result.
00:55 First, I will explain about types of errors.
01:00 Syntax error is a violation of grammatical rules of a programming language.
01:09 Compilation fails when a program has syntax errors.
01:15 Syntax errors are easy to find and fix.
01:22 For Example:,Unmatched parentheses, square and curly braces.
01:29 Use of variable that has not been declared.
01:34 Missing quotes in strings.
01:38 Let's open a new KTurtle Application.
01:42 Click on Dash home. In the Search bar, type: "kturtle".
01:48 Click on the KTurtle icon.
01:51 Let's begin the tutorial with some types of syntax errors.
01:58 I already have a program in a text-editor.
02:02 To explain the error in the program, I will comment part of the code.
02:09 Here, I will comment the line.
02:11 $a=ask within double quotes "enter any number and click Ok".
02:19 I will use hash(#) sign to comment the line.
02:23 I will copy the program from text-editor and paste it into Kturtle's editor.
02:31 Pause the tutorial here and type the program into your KTurtle editor.
02:37 Resume the tutorial after typing the program.
02:42 Let's click on Run button to run the program.
02:47 Compiler shows the following error:
02:50 "variable '$a' was used without first being assigned to a value".
02:57 Here, the error is in line number 4.
03:02 This is a syntax error. It occurred as the variable 'a' was not declared.
03:10 So, I will go to line number 2, remove the comment.
03:14 I will copy the program from text-editor and paste it into KTurtle's editor.
03:23 Let's click on Run button to run the program.
03:27 Enter '6' for 'a' value and click OK.
03:31 Program runs without errors.
03:35 I will clear the current program from KTurtle editor.
03:38 Type "clear" command and Run to clean the canvas.
03:43 Let's next look at another error.
03:46 I already have a program in a text-editor.
03:50 Here, the value of "pi" is predefined in KTurtle.
03:54 Let's delete the '$' sign in the program.
03:58 I will copy the program from text editor and paste it into Kturtle's Editor.
04:05 Pause the tutorial here and type the program into your KTurtle editor.
04:11 Resume the tutorial after typing the program.
04:16 Let's click on Run button to run the program.
04:19 Complier shows the following error:
04:22 "You cannot put '=' here".
04:26 This error is in line number 2.
04:30 This is a syntax error. It occurred as there is no container of variable.
04:37 Let's go back to the program, replace the '$' sign.
04:41 I will copy the program from text editor and paste it into KTurtle's editor.
04:49 Let's click on Run button to run the program.
04:53 Enter 45 for angle value and click OK.
04:57 Program runs without errors.
05:00 Let's remove one of the quotes of the string.
05:05 I will copy the program from text editor and paste it into KTurtle's editor.
05:12 Click on Run button to run the program.
05:15 Complier shows the following error:
05:18 'Text string was not properly closed, expected a double quote (") to close the string'.
05:25 Here, the error is in line number 2.
05:29 I will go back to line number 2 and replace the quotes.
05:34 I will copy the program from text editor and paste it into Kturtle's editor.
05:41 Click on Run button to run the program.
05:44 Enter '45' for angle value and click OK.
05:49 Program runs without errors.
05:52 This way you can find the line at which error has occurred and also correct it.
05:59 Let's now learn about run time errors.
06:04 Run-time error occurs during the execution of a program.
06:10 It may crash the program when you run it.
06:15 Runtime errors are commonly due to wrong input from the user.
06:23 Compiler cannot find these errors.
06:27 For example:
06:29 Trying to divide by a variable that contains no value.
06:31 Run a loop without a terminating condition or increment value.
06:43 I will clear the current program from the editor.
06:47 Type "clear" command and Run to clean the canvas.
06:52 I already have a program in a text editor.
06:56 This program divides two numbers.
07:00 'a' is dividend and 'r' is divisor.
07:04 I will copy the program from text editor and paste it into KTurtle's editor.
07:11 Pause the tutorial here and type the program into your KTurtle editor.
07:16 Resume the tutorial after typing the program.
07:20 Let us click on Run button to run the program.
07:24 Let's enter '5' for 'a' and click OK,
07:29 enter '0' for 'r' and click OK.
07:33 Here, we get a run time error:
07:36 “you tried to divide by zero”.
07:39 This error is in line number 4.
07:43 This error occurs as we cannot divide a number with zero.
07:49 Let us run again.
07:51 Enter '5' for 'a' and click OK,
07:54 enter '2' for 'r' and click OK.
07:58 Program runs without errors.
08:01 I will clear the current program from KTurtle editor.
08:05 Type "clear" command and Run to clean the canvas.
08:10 Next, we will learn about logical errors.
08:14 Logical error is a mistake in a program's source code that results in incorrect or unexpected behavior.
08:26 For example-
08:28 Assigning a value to a wrong variable.
08:32 Multiplying two numbers instead of adding.
08:36 I already have a program in a text editor.
08:39 I will copy the program from text editor and paste it into Kturtle's editor.
08:47 Pause the tutorial here and type the program into your KTurtle editor.
08:52 Resume the tutorial after typing the program.
08:57 Now click on the Run button to run the program.
09:01 A dialog-box pops-up; let's click OK.
09:05 Loop goes into an infinite loop.
09:08 We see that “while” loop prints numbers from 31 and is still printing.
09:15 This is a logical error.
09:18 In the “while” condition 'x' is greater than 20
09:23 but the variable 'x' is always greater than 20.
09:28 So, the loop never terminates.
09:31 I will click on Abort button to abort the process.
09:36 Let's change $x=$x+1 to $x=$x-1.
09:44 I will copy the program from text editor and paste it into KTurtle's editor.
09:51 Let's click on Run button to run the program.
09:55 A dialog-box pops up. Let us click OK.
09:59 Loop terminates after printing the values from 29 to 20.
10:05 With this, we come to the end of this tutorial.
10:10 Let us summarize.
10:12 In this tutorial, we have learnt errors and types of errors such as-
10:18 Use of variable that has not been declared.
10:23 Missing quotes in strings.
10:27 Runtime errors' and
10:30 Logical errors.As an assignment, I would like you to find errors in the given programs.
10:46 Watch the video available at this URl:

http://spoken-tutorial.org/What_is_a_Spoken-Tutorial

10:50 It summarizes the Spoken Tutorial project.
10:54 If you do not have good bandwidth, you can download and watch it.
10:59 The Spoken Tutorial Project team :Conducts workshops using spoken tutorials.
11:05 Gives certificates to those who pass an online test.
11:09 For more details, please write to:

contact@spoken-tutorial.org

11:17 Spoken Tutorial project is a part of the Talk to a Teacher project.
11:23 It is supported by the National Mission on Education through ICT, MHRD, Government of India.
11:31 More information on this mission is available at this link:

http://spoken-tutorial.org/NMEICT-Intro.

11:37 This is Madhuri Ganpathi from IIT Bombay, signing off.
11:41 Thank you for joining.