Posts

Python Programming – Class XII State Syllabus Guide

XII Class  Part 1: Exception Handling Program 1: Syntax Error vs Exception # Syntax Error Example (won't run) # print("Hello # Exception Example (will run but gives error) a = 5 b = 0 try : print (a / b) except ZeroDivisionError : print ( "You cannot divide by zero!" ) Program 2: Try-Except-Else-Finally try : num = int ( input ( "Enter a number: " )) print ( 100 / num ) except ValueError : print ( "That's not a number!" ) except ZeroDivisionError : print ( "Zero is not allowed!" ) else : print ( "Division successful!" ) finally : print ( "End of program." ) Program 3: Raising Exceptions def check_age ( age ): if age < 18 : raise ValueError ( "You must be 18 or older!" ) return True try : check_age ( 15 ) except ValueError as e : print ( "Exception:" , e ) Program 4: User-Defined Exception class UnderAgeError ( Excep...

Machine Learning Lab

1. Install and set up Python and essential libraries like NumPy and pandas. Install NumPy and pandas : Open a command prompt (Windows) or terminal (macOS / Linux). To install NumPy, type : pip install numpy To install pandas , type : pip install pandas Press Enter and wait for the installation to complete. Verify installation : After installation , you can verify if NumPy and pandas are installed correctly by opening a Python interpreter. Type python in your command prompt or terminal to open the Python interpreter. Once inside the Python interpreter, try importing NumPy and pandas: python import numpy import pandas If there are no errors, the libraries are successfully installed. 2.Introduce scikit-learn as a machine learning library Here 's an introduction to some key aspects of scikit-learn: 1. Versatility : scikit - learn offers a wide range of machine learning algorithms and tools that are suitable for various tasks such as classification,regression, clus...