School Revise · Class 12 Artificial Intelligence · Unit 1
Code 843, Class 12. AI needs strong Python and data skills. Here we use functions, NumPy and Pandas to handle data.
|
|
We build on Python with functions, and the NumPy and Pandas libraries that AI uses to work with numbers and data.
A function is reusable code that can return a result. Lists and loops process many values, and a list comprehension builds a list in one line.
|
squares = [x * x for x in range(1, 4)] print(squares) Output: [1, 4, 9] |
NumPy works with arrays of numbers. np.array([…]) makes an array, and a.sum(), a.mean() and a.max() summarise it quickly.
Pandas handles data in tables. A DataFrame is a table; df.groupby summarises groups and df[“col”].mean() gives an average, ready for analysis.
Explore the idea by tapping. The interactive opens right here in the lesson.
Write and run real Python right here in the lesson, then work through the practice problems with answers.
Type each one into the code lab above, then open the card to see the worked solution and its output.
SOLUTION
OUTPUT
SOLUTION
OUTPUT
SOLUTION
OUTPUT
SOLUTION
OUTPUT
SOLUTION
OUTPUT
SOLUTION
OUTPUT
SOLUTION
OUTPUT
SOLUTION
OUTPUT
SOLUTION
OUTPUT
SOLUTION
OUTPUT
NumPy.
Pandas.
A list comprehension.
groupby().
|
Python for AI uses functions (reusable code that returns a result), list comprehensions (build a list in one line), and libraries. NumPy works with arrays of numbers (sum, mean, max). Pandas handles data in tables: a DataFrame holds rows and columns, groupby summarises groups, and mean gives averages, ready for analysis. |
| Open the Virtual Lab |
These free Class 12 Artificial Intelligence (Code 843) notes explain Python programming for AI, functions and list comprehensions, and the NumPy and Pandas libraries with groupby with clear examples and practice, for CBSE students across India and the Gulf including the UAE, Saudi Arabia, Qatar, Oman, Kuwait and Bahrain.
© 2026 School Revise. All rights reserved. Original content aligned to the CBSE and NCERT Class 12 Artificial Intelligence syllabus. Unauthorised copying is not permitted.