Data Science From Scratch: Comprehensive Beginners Guide To Learn Data Science From Scratch by George Henry

Data Science From Scratch: Comprehensive Beginners Guide To Learn Data Science From Scratch by George Henry

Author:George, Henry [George, Henry]
Language: eng
Format: epub
Published: 2020-01-22T16:00:00+00:00


Exceptions

As a beginner, a lot of errors are bound to happen in the course of running your codes. The moment the interpreter encounters an error, it terminates the program. There are two possible errors that can occur, a syntax error and an exception. A syntax error is caused when a command statement is not written in the correct format. For example,

Dictry = { }

print ( "Empty Dictionary: " )

print ( Dictry ))

SyntaxError: invalid syntax

The error was caused by the incorrect print statement in the 3rd line. An exception occurs when a properly constructed command statement results in an error. For an exception, the interpreter prints a Traceback in the window. These Tracebacks show you exactly where the error originated. For example,

Traceback (most recent call last):

File "C:/Python27/Lib/idlelib/bs.py", line 67, in <module>

Dictry_b.pop( 5 )

KeyError: 5

This traceback tells you that the error originated in the 67th line and was caused due to the absence of key 5 in the dictionary Dictry_b .



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.