Testing: Errors.

Created
Tags

There are 3 types of errors.

Syntax errors.

This is because there is a mistake in the way the program is written and has nothing to do with logic. eg:

print("Hello World)

Logic errors:

Problems with the code itself. The program will still work but the output will be unexpected.

usernum = int(input("What number do you want to compare to 100?"))
#simple number comparison program.
if usernum < 100:
	print("Your number was greater than 100.") #can you identify the error?

Runtime Errors (Execution errors):

These are errors that happen while the program is running. For example, division by zero or attempting to write to a nonexistent file.

usernum = int(input("What is the first number"))
usernum2 = int(input("What is the second number")) #entering 0 would cause a runtime error.
answer = usernum/usernum2
print(str(answer))