Meaning of Debugging
Debugging means the process of finding errors, finding reasons for errors, and techniques of their fixation. An error, also known as a bug, is a programming code that prevents a program interpretation.
Errors are of three types –
- Compile Time Error
- Run Time Error
- Logical Error
Compile-time error :
These errors are basically of 2 types –
Syntax Error: Violation of formal rules of a programming language results in a syntax error.
For ex-
a=5
if a>10
SyntaxError: ‘:’ syntax error
Semantics Error: Semantics refers to the set of rules which sets the meaning of statements. A meaningless statement results in semantics error.
For ex-
x * y = z
Logical Error
If a program is not showing any compile-time error or run time error but not producing desired output, it may be possible that the program is having a logical error. These are not detected by the compiler or interpreter. These are hard to detect.
Some example-
- Use a variable without an initial value.
- Provide wrong parameters to a function.
- Use of the wrong operator in place of correct operator required for operation.
X=a+b (here – was required in place of + as per requirement
Run time Error
These errors are generated during a program execution due to resource limitations. Python is having the provision of checkpoints to handle these errors.
For ex-
a=10
b=int(input(“enter a number”))
c=a/b
Value of b to be entered at run time and the user may enter 0 at run time, that may cause run time error because any number can’t be divided by 0
Run time Error in Python
In Python, try and except clauses are used to handle an exception/runtime error which is known as exception handling
try:
# code with a probability of exception will be written here.
a=10
b=int(input(“enter a number”))
c=a/b
except:
#code to handle exception will be written here.
print(“divide by zero error”)
[wpdatatable id=1]
**mindvault**
mindvault is a premium cognitive support formula created for adults 45+. It’s thoughtfully designed to help maintain clear thinking
**gl pro**
gl pro is a natural dietary supplement designed to promote balanced blood sugar levels and curb sugar cravings.
**vittaburn**
vittaburn is a liquid dietary supplement formulated to support healthy weight reduction by increasing metabolic rate, reducing hunger, and promoting fat loss.
**prodentim**
prodentim an advanced probiotic formulation designed to support exceptional oral hygiene while fortifying teeth and gums.
**glucore**
glucore is a nutritional supplement that is given to patients daily to assist in maintaining healthy blood sugar and metabolic rates.
**synaptigen**
synaptigen is a next-generation brain support supplement that blends natural nootropics, adaptogens
**wildgut**
wildgutis a precision-crafted nutritional blend designed to nurture your dog’s digestive tract.