|

Advance Python Notes – Class 10 AI (417) | Complete Practical

Get Advance Python Notes — 100% Free, Practical & CBSE-Aligned! Master every topic with clear explanations, real code examples, and exam-ready concepts.

What You Need to Learn in Python for Class 10 AI

Python in Class 10 AI is assessed through practical work only. There is no separate theory exam for Python. According to the new CBSE syllabus, you are required to prepare a practical file containing a minimum of 15 programs. Therefore, learning Python is an important part of your preparation.

If you look at the Class 10 AI book, you will find that most of the Python syllabus is common to both Class 9 and Class 10 AI. The common topics include:

So, if you have already learned these topics in Class 9, you will find much of the Class 10 Python syllabus familiar. However, Class 10 also introduces one additional topic:

  • Python Packages
  • Numpy
  • Introduction to Jupyter Notebook

Since you are now in Class 10, it is expected that you have already learned the basics of Python in Class 9. But if you are still struggling with Python or want to learn it from the beginning, don’t worry!

Python Fundamentals

👉 Click on the link below to strengthen your Python basics completely. Once you are comfortable with the basics, you can move ahead with Python Built-in Functions and Modules.

🔗Introduction to Python – Class 9 AI (417)

Alright..Done with the basics! 🎉 I hope you have gone through the Python fundamentals mentioned above👆and are now ready to learn the Advanced Python of Class 10 AI as per the CBSE curriculum. So, why wait? Let’s dive into advanced Python! 🚀

What is Python Packages

  • A package is a space where you can find codes, functions, or modules of similar types.
  • Python has many packages available for free because it is an open-source language.

Some Readily Available Python Packages

  • NumPy: A package used for working with numerical arrays.
  • OpenCV: An image processing package used for image manipulation and processing.
  • Matplotlib: A package used to plot numerical data in graphical form.
  • NLTK: Stands for Natural Language Tool Kit.
  • Pandas: A package used for handling 2-dimensional data tables in Python.

How to Install Python Packages

We can install Python Packages using command pip. for example:

pip install pandas

In Anaconda we can use conda command to install packages. for example:

conda install pandas

During installation, press Y to continue when prompted.

Working with Packages

  • After installation, we need to import the package in our Python script.
  • Importing allows us to use the package’s functionalities.
  • for example:
    import numpy as np

What is NumPy

  • NumPy stands for Numerical Python.
  • It is a package used for mathematical and logical operations on arrays.
  • NumPy supports N-dimensional arrays, also called ND-arrays.

What is an Array

  • An array is a collection of multiple values of the same datatype.
  • It can contain numbers, characters, Booleans, etc., but only one datatype can be accessed through an array.
  • NumPy arrays are called N-dimensional arrays because they can have any number of dimensions.

NumPy Array vs Python List

NumPy ArrayPython List
Contains data of the same type.Can contain different types of data.
Less flexible with datatypes.More flexible with datatypes.
Used for arithmetic operations.Used for data management.
Example: numpy.array([1,2,3])Example: [1,2,3]

Creating Numpy Arrays

PurposeCode
Create an arraynumpy.array([1,2,3,4,5])
Create a 2-D zero array (4 × 3)numpy.zeros((4,3))
Create an array with 5 random valuesnumpy.random.random(5)
Create a 2-D array of 6s (3 × 4)numpy.full((3,4),6)
Create a sequence from 0 to 30 with gaps of 5numpy.arrange(0,30,5)

Arithmetic Operations on Arrays

Suppose:

ARR = numpy.array([1,2,3,4,5])

OperationCode
Add 5 to each elementARR + 5
Divide each element by 5ARR / 5
Square each elementARR ** 2
Access the 2nd elementARR[1]
Multiply two arraysARR * BRR

Remember: Array indexing starts from 0, so the 2nd element is accessed using index 1.

Properties of an Array

Function / AttributeUse
type(ARR)Find the type of an array
ARR.ndimCheck the number of dimensions
ARR.shapeFind the shape of an array
ARR.sizeFind the number of elements
ARR.dtypeFind the datatype of elements

Mathematical Functions in NumPy

FunctionUse
ARR.max()Find the maximum element
ARR.max(axis = 1)Find row-wise maximum elements
ARR.min(axis = 0)Find column-wise minimum elements
ARR.sum()Find the sum of all elements

Similar Posts

Leave a Reply

Your email address will not be published. Required fields are marked *