An exception is an error or unexpected event that occurs during execution of a program. Exception interrupts the flow of the program thus it needs to be handled for the program to continue running or else the program may be forced to quit. The process of responding to exceptions is called Exception Handling. Exception handling attempts to gracefully handle these situations so unexpected errors can be detected and managed without crashing the program. In python, the error handling is done through the use of exceptions that are caught in try blocks and handled in except blocks. If an error is encountered, a try block code execution is stopped and transferred down to the except block. In addition to using an except block after the try block, you can also use the finally block. The code in the finally block will be executed regardless of whether an exception occurs. Some common exceptions errors in Python includes: IOError - Raised when the file cannot be opened. ImportError - Raised when python cannot find the module ValueError - Raised when a built-in operation or function receives an argument that has the right type but an inappropriate value KeyboardInterrupt - Raised when the user hits the interrupt key (normally Control-C or Delete) EOFError - Raised when one of the built-in functions (input() or raw_input()) hits an end-of-file condition (EOF) without reading any data To use exception handling in Python, you first need to have a catch-all except clause. The words "try" and "except" are Python keywords and are used to catch exceptions. try-except [exception-name] blocks The code within the try clause will be executed statement by statement. If an exception occurs, the rest of the try block will be skipped and the except clause will be executed. try: some statements here except: exception handling A list is a collection which is ordered and changeable. In Python, lists are comma-separated values (items) between square brackets. You access the list items by referring to the index number. The items in a list need not be of the same type. Python for Data Science It is one of the best languages used by data scientist for various data science projects/application. Python provide great functionality to deal with mathematics, statistics and scientific function. It provides great libraries to deals with data science application. Reasons why Python is widely used for Data Science Python has a unique attribute and is easy to use when it comes to quantitative and analytical computing. Data Science Python is widely used and is a favorite tool along being a flexible and open sourced language. Its massive libraries are used for data manipulation and are very easy to learn even for a beginner data analyst. Most Commonly used python libraries for data science: Numpy: Numpy is Python library that provides mathematical function to handle large dimension array. It provides various method/function for Array, Metrics, and linear algebra. Pandas: Pandas is one of the most popular Python library for data manipulation and analysis. Pandas is designed for quick and easy data manipulation, aggregation, and visualization. Matplotlib: Matplolib is another useful Python library for Data Visualization. Matplotlib allows to quickly make line graphs, pie charts, histograms, and other professional grade figures. Scipy: Scipy is another popular Python library for data science and scientific computing. Scipy provides great functionality to scientific mathematics and computing programming. SciPy contains sub-modules for optimization, linear algebra, integration, interpolation etc. Scikit – learn: Sklearn is Python library for machine learning. It provides easy and simple tools for data mining and data analysis. Python for Artificial Intelligence Python comes with a huge number of inbuilt libraries. Many of the libraries are for Artificial Intelligence. A great choice of libraries is one of the main reasons Python is the most popular programming language used for AI. A library is a module or a group of modules published by different sources like PyPi which include a pre-written piece of code that allows users to reach some functionality or perform different actions. Python libraries provide base level items so developers don’t have to code them from the very beginning every time. Python Libraries for General AI AIMA – Python implementation of algorithms from Russell and Norvig’s ‘Artificial Intelligence: A Modern Approach.’ pyDatalog – Logic Programming engine in Python SimpleAI – Python implementation of many of the artificial intelligence algorithms described on the book “Artificial Intelligence, a Modern Approach”. It focuses on providing an easy to use, well documented and tested library. EasyAI – Simple Python engine for two-players games with AI (Negamax, transposition tables, game solving).