top of page

Keep Reading !

You can also checkout more topics like...

peep-101_edited.png
EXPLORE COURSES (6).png
EXPLORE COURSES (9).png
EXPLORE COURSES (7)_edited.jpg

EOFError Exception in Python

EOFError is raised when one of the underlying functions input() or raw_input() hits a finish of-record condition (EOF) without perusing any information. This blunder is now and then experienced while utilizing online IDEs. This happens when we have asked the client for input however have not given any input in the input box. We can beat this issue by utilizing attempt to with the exception of catchphrases in Python. This is called as Exception Handling**.







advertisement



PYTHON

try:
	m = int(input())
	print(m * 10)
	
except EOFError as e:
	print(e)

OUTPUT


EOF when reading a line

advertisement

**Exception Handling**


Exception are raised when the program is linguistically right yet the code brought about a blunder. This blunder doesn't stop the execution of the program, be that as it may, it changes the ordinary progression of the program.


Example


#initialize the variable
marks = 10000

# division with 0
a = marks / 0
print(a)

Output


	Traceback (most recent call last):
  File "script.py", line 5, in <module>
    a = marks / 0
ZeroDivisionError: division by zero

advertisement




382 views0 comments
bottom of page