Important Notice:

Course Content
Introduction to Programming (Chapter 1) M3-R5.1
About Lesson

Note:- Program Debugging Is The Process Of Finding And Correcting Errors (“Bugs”) In A Computer Program

There are three types of errors that occur in a computer program

  1. Syntax error
  2. Run-time error
  3. Logical error

Syntax Errors

Python में Syntax Errors program में syntax सही न होने के कारण आती हैं, इन्हे parse errors भी कहते हैं जो कि interpret time पर आती हैं। Syntax error जब रहेगी तब तक program बिलकुल भी run नहीं होगा।

10-5=

SyntaxError: cannot assign to expression

print “hello”

SyntaxError: Missing parentheses in call to ‘print’. Did you mean print(…)?

 

Runtime Errors

Runtime Errors, program के running time पर किसी गलत logic या गलत input की वजह से आती हैं, run time errors को ही exceptions कहते हैं। Run time error आने तक पूरा program proper run होता है और output भी proper generate होता है।

>>> a=1

>>> b=0

>>> print(a/b)

Traceback (most recent call last):

  File “<stdin>”, line 1, in <module>

ZeroDivisionError: division by zero

Logical Errors

    Logical Errors, program में apply किये गए logic में mistake की वजह से आती हैं। इन Logical Errors की वजह से हमें desirable output नहीं मिलता। Logical Errors को बिना किसी tool के handle करना मुश्किल है।

i=100

while i<10:

    i=i+2

    print(i)

 

Syntax Errors

A syntax error is one of the most basic types of error in programming. Whenever we do not write the proper syntax of the python programming language (or any other language) then the python interpreter or parser throws an error known as a syntax error. The syntax error simply means that the python parser is unable to understand a line of code.

10-5=

SyntaxError: cannot assign to expression

print “hello”

SyntaxError: Missing parentheses in call to ‘print’. Did you mean print(…)?

 

Runtime Errors

In Python, a runtime error occurs when the program is executing and encounters an unexpected condition that prevents it from continuing. Runtime errors are also known as exceptions and can occur for various reasons such as division by zero, attempting to access an index that is out of range, or calling a function that does not exist.

>>> a=1

>>> b=0

>>> print(a/b)

Traceback (most recent call last):

  File “<stdin>”, line 1, in <module>

ZeroDivisionError: division by zero

Logical Errors

            Logical errors are the errors that occur in planning the program logic. In this case, the language processor successfully translates the source code into machine code. The computer actually does not know that an error has been made. If follows the program instructions and outputs the results, but the result of the output may not be correct.

i=100

while i<10:

    i=i+2

    print(i)

 

 

 

 

 

 

 

 

error: Content is protected !!