Download presentation
Presentation is loading. Please wait.
1
Can you pick 3 errors from this
Starter Can you pick 3 errors from this Temp = input("What is the temperature in the house?") if (int(Temp) <= 15): Print ("The temperature is ", Temp, "degrees. Time to put the heating on") else: print "The temperature is ", Temp, "degrees. The heating is going off"
2
Can you pick 3 errors from this
Starter Can you pick 3 errors from this Temp = input("What is the temperature in the house?") if (int(Temp) <= 15): Print ("The temperature is ", Temp, "degrees. Time to put the heating on") else: print ("The temperature is ", Temp, "degrees. The heating is going off“) How tedious is that?
3
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
4
Making errors... Making mistakes is okay. It happens all the time!
But you don’t release a game with errors
5
Errors in programs and being able to handle them.
There are basically 3 types Of error… Logic Syntax Runtime
6
Errors in programs and being able to handle them.
An error in the design of the program, wrong programming or wrong logic. (May not produce an error – just wrong outcome) often no obvious error is flagged up Often due to mistake in the algorithm or wrong data type. Format errors failing to follow the grammar rules of the programming language used.
7
What errors? print hello world syntax
8
What errors? Name = 'Al' print(‘You can call me ' + name)
Runtime error
9
What errors? spam = 'THIS IS IN LOWERCASE.' spam = spam.lowerr()
Runtime error
10
What errors? x = 3 y = 4 average = x + y / 2 print(average)
11
What errors? spam = ['cat', 'dog', 'mouse'] print(spam[6])
Runtime error
12
Errors in programs and being able to handle them.
Type Error Runtime NameError ZeroDivisionError KeyBoardInterrupt When a name is used that is not known about (often a variable name that is misspelt). Dividing a number by zero. When a program is interrupted from the keyboard by pressing control+c. An error occurs when the program is running. When an operation is attempt that is invalid for that type of data. Specific to python
13
Odd task alert Go away and try to make mistakes: Make an example of: A runtime error A syntax error A logic error
14
Trace Table A technique used to test algorithms to see if any logic errors occur when the algorithm is processed.
15
Testing for errors before and during the coding stages
16
Testing for errors during the execution of code
Breakpoints Steps Watches
17
Activity 4.1 and 4.2 4.3 4.4 4.5 and 4.6
Similar presentations
© 2025 SlidePlayer.com Inc.
All rights reserved.