Presentation is loading. Please wait.

Presentation is loading. Please wait.

Lesson Outcomes 2.1.3 Be able to identify differentiate between types of error in programs 2.1.4 Be able to interpret error messages and identify, locate.

Similar presentations


Presentation on theme: "Lesson Outcomes 2.1.3 Be able to identify differentiate between types of error in programs 2.1.4 Be able to interpret error messages and identify, locate."— Presentation transcript:

1 Lesson Outcomes 2.1.3 Be able to identify differentiate between types of error in programs 2.1.4 Be able to interpret error messages and identify, locate and fix errors in a program. 2.1.7 Be able to make effective use of tools offered in an integrated development environment [watcher, break points, single step, step throughs] What causes error messages All of should be able to recall different error types All of you should be able to recall error messages in python All of you should be able to use a trace table All of you should be able to use a debugger software

2 Quick recap – Error handling keywords
Syntax Run time Logic

3 Testing for logic errors
Trace Table A technique used to test algorithms to see if any logic errors occur when the algorithm is processed. Testing for logic errors

4 Are you happy with this function?
Example 1 Are you happy with this function? for next in range(1,10,2): number1 = next number2 = next * next number3 = next / 2 next number1 number2 number3

5 Example 1 for next in range(1,10,2): number1 = next
number2 = next * next number3 = next / 2 next number1 number2 number3 1 0.5 3 9 1.5 5 25 2.5 7 49 3.5 81 4.5

6 Example 2 C A B A = 3 B = 3 For C = 1 to 4 B = B*C A = A+C Next C

7 Example 2 C A B 1 4 3 2 6 9 18 13 72 (Psueudocode) A = 3 B = 3 For C = 1 to 4 B = B*C A = A+C Next C

8 Example 3 Pseudocode A=4 B=7 1 Input A 2 Input B 3 If A=B Then 4 B = 2
5 Else 6 While B>A 7 B=B-A 8 End While 9 A = B + 5 10 End IF Variable Line A B Comment 1 2 3 4 5 6 7 8 9 10

9 Example 3 Pseudocode A=4 B=7 1 Input A 2 Input B 3 If A=B Then 4 B = 2
5 Else 6 While B>A 7 B=B-A 8 End While 9 A = B + 5 10 End IF Variable Line A B Comment 1 4 2 7 3 False: goto 6 5 6 True: continue 8 9 10

10 Break.... Which is the odd one out? Type Error Runtime NameError
Variableinterupt ZeroDivisionError KeyBoardInterrupt Typeinputerror

11 Object Orientated Programming
Bugs can be hard to find... Constant Assignment Data System Information Array / list Variable Algorithm Boolean Data structure Pseudocode Find it... Object Orientated Programming Integer Binary Identifier Real / Float

12 “Debug tools” or “Debugger”
Single step (where the program is executed one statement at a time – performs a ‘step through’ Setbreak points (Positions in the program when its halted and variables can be checked to locate logic errors) Watchers (Allow a programmer to watch for certain events such as variables changing)

13 Debugger in Python

14 The best way to learn about it...is to use it. Your task: Over to you...
Take some of your programs and use the debugger (rock, paper, scissors game?) Then take an old program you have made (sabotage it and look at how it might pick it up)

15 Homework For next lesson (Tuesday)


Download ppt "Lesson Outcomes 2.1.3 Be able to identify differentiate between types of error in programs 2.1.4 Be able to interpret error messages and identify, locate."

Similar presentations


Ads by Google