0% found this document useful (0 votes)
5 views1 page

Python_Errors_Exceptions_CBSE

The document outlines common Python errors and exceptions encountered in programming, providing definitions and examples for each type. Errors include SyntaxError, IndentationError, NameError, and others, detailing what causes them and how they manifest in code. This serves as a reference for students in CBSE Class 11 and 12 to understand and troubleshoot Python programming issues.

Uploaded by

devangsarpotdar1
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views1 page

Python_Errors_Exceptions_CBSE

The document outlines common Python errors and exceptions encountered in programming, providing definitions and examples for each type. Errors include SyntaxError, IndentationError, NameError, and others, detailing what causes them and how they manifest in code. This serves as a reference for students in CBSE Class 11 and 12 to understand and troubleshoot Python programming issues.

Uploaded by

devangsarpotdar1
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

Common Python Errors & Exceptions (CBSE Class 11 & 12)

Error Type Definition Example

SyntaxError Incorrect syntax. if x > 5 print(x)

IndentationError Improper indentation. if x > 5:print(x)

NameError Name not defined. print(y)

TypeError Wrong operation on type. 5 + 'string'

ValueError Right type, wrong value. int('abc')

ZeroDivisionError Division by zero. 10 / 0

IndexError Index out of range. my_list[5]

KeyError Missing dictionary key. my_dict['b']

ModuleNotFoundError Module not found. import non_existent_module

ImportError Function/module can't be imported. from math import fake

EOFError No input received. input()

AttributeError Invalid attribute reference. my_list.non_existent_method()

RuntimeError Generic runtime error. infinite loop

FileNotFoundError File doesn't exist. open('no.txt')

PermissionError Lack of permission. open('protected.txt', 'w')

OverflowError Numeric value too big. math.exp(1000)

MemoryError Out of memory. [1] * (10**10)

RecursionError Max recursion exceeded. def r(): r(); r()

AssertionError Assertion failed. assert 2 + 2 == 5

NotImplementedError Method not implemented. raise NotImplementedError

StopIteration No more items in iterator. next(iter([1,2,3]))

Page 1

You might also like