Python Programs for CBSE Class 10 AI Projects

Introduction
Artificial Intelligence is an exciting field and CBSE Class 10 AI curriculum encourages students to build simple, meaningful projects using the AI Project Cycle. These projects help students understand problem solving, data collection, data processing, model building, and result evaluation.
Below are six CBSE Class 10 AI project ideas in Python with complete code. All projects are simple enough for beginners and can be run in Google Colab, Jupyter Notebook, or any Python IDE.
1. Sentiment Analysis of Student Reviews
Objective
Classify short student reviews as positive, negative, or neutral using Natural Language Processing.
Dataset
Create a CSV file with 50–100 one-line reviews from classmates about school events, facilities, or movies.
Steps
- Collect and label the data.
- Clean the text.
- Train a sentiment analysis model.
- Test it with new reviews.
Python Code
from textblob import TextBlob
# Sample reviews
reviews = [
"The sports day was amazing and full of fun",
"I did not enjoy the event at all",
"It was okay but could have been better"
]
for review in reviews:
blob = TextBlob(review)
sentiment = blob.sentiment.polarity
if sentiment > 0:
mood = "Positive"
elif sentiment < 0:
mood = "Negative"
else:
mood = "Neutral"
print(f"Review: {review} - Sentiment: {mood}")
Expected Output
Each review will be labeled as Positive, Negative, or Neutral.
Viva Questions
- What is sentiment polarity?
- Why do we clean text before processing?
2. Handwritten Digit Recognition
Objective
Recognize handwritten digits (0–9) using a simple machine learning model.
Dataset
Use the built-in digits
dataset from scikit-learn.
Steps
- Load the dataset.
- Train a logistic regression classifier.
- Test on unseen data.
Python Code
from sklearn import datasets, metrics
from sklearn.model_selection import train_test_split
from sklearn.linear_model import LogisticRegression
# Load dataset
digits = datasets.load_digits()
# Split into train and test
X_train, X_test, y_train, y_test = train_test_split(digits.data, digits.target, test_size=0.2)
# Train model
model = LogisticRegression(max_iter=10000)
model.fit(X_train, y_train)
# Predict
y_pred = model.predict(X_test)
# Accuracy
print("Accuracy:", metrics.accuracy_score(y_test, y_pred))
Expected Output
An accuracy score between 0.90 and 0.95 depending on system and random split.
Viva Questions
- What is a pixel?
- How does the model learn from image data?
3. School FAQ Chatbot
Objective
Answer common school questions using a rule-based chatbot.
Dataset
Create a Python dictionary with common questions and answers.
Steps
- Map keywords to responses.
- Take input from the user.
- Display matching responses.
Python Code
responses = {
"hello": "Hello, how can I help you?",
"admission": "Admissions are open till 30th September.",
"fees": "The annual school fee is fifty thousand rupees.",
"timing": "School timing is 8 AM to 2 PM.",
"goodbye": "Goodbye and have a nice day."
}
while True:
user_input = input("You: ").lower()
if user_input in responses:
print("Bot:", responses[user_input])
if user_input == "goodbye":
break
else:
print("Bot: Sorry, I do not have an answer for that.")
Expected Output
The chatbot answers correctly for known questions and politely for unknown ones.
Viva Questions
- How is a rule-based chatbot different from a machine learning chatbot?
- What happens when no matching response is found?
4. Color Detection in Images
Objective
Detect the RGB values of a specific pixel in an image.
Dataset
Any school or personal image saved as image.jpg
.
Steps
- Load the image.
- Pick coordinates.
- Read RGB values.
Python Code
import cv2
# Load image
image = cv2.imread('image.jpg')
# Coordinates
x, y = 50, 100
(b, g, r) = image[y, x]
print(f"Pixel at ({x},{y}) - Red: {r}, Green: {g}, Blue: {b}")
# Show image
cv2.imshow("Image", image)
cv2.waitKey(0)
cv2.destroyAllWindows()
Expected Output
RGB values for the selected pixel.
Viva Questions
- What is RGB?
- How does light affect color detection?
5. Marks Prediction from Study Hours
Objective
Predict student marks based on daily study hours.
Dataset
Hours studied and marks obtained for 30–50 students.
Steps
- Create dataset.
- Train a regression model.
- Predict marks for given hours.
Python Code
from sklearn.linear_model import LinearRegression
import numpy as np
# Dataset
X = np.array([1, 2, 3, 4, 5]).reshape(-1, 1)
y = np.array([35, 50, 65, 75, 85])
# Train model
model = LinearRegression()
model.fit(X, y)
# Predict for 6 hours of study
predicted = model.predict([[6]])
print(f"Predicted Marks: {predicted[0]:.2f}")
Expected Output
Predicted marks for 6 study hours, around 90 depending on dataset.
Viva Questions
- What is regression?
- Why is it important to split data into train and test sets?
6. News Topic Classification
Objective
Classify short news headlines into categories like sports, politics, technology, and entertainment.
Dataset
Prepare a CSV file with at least 100 headlines.
Steps
- Clean text.
- Convert to features.
- Train a classifier.
- Test accuracy.
Python Code
from sklearn.feature_extraction.text import CountVectorizer
from sklearn.model_selection import train_test_split
from sklearn.naive_bayes import MultinomialNB
from sklearn import metrics
# Sample data
headlines = [
"India wins cricket match",
"New smartphone launched in market",
"Government passes new education bill",
"Actor announces new movie release"
]
labels = ["sports", "technology", "politics", "entertainment"]
# Vectorize text
vectorizer = CountVectorizer()
X = vectorizer.fit_transform(headlines)
# Train-test split
X_train, X_test, y_train, y_test = train_test_split(X, labels, test_size=0.25)
# Train model
model = MultinomialNB()
model.fit(X_train, y_train)
# Predict
y_pred = model.predict(X_test)
print("Accuracy:", metrics.accuracy_score(y_test, y_pred))
Expected Output
Accuracy score based on given dataset.
Viva Questions
- What is Bag of Words?
- How do you handle unknown words in text classification?
Conclusion
These Python programs cover various AI topics in the CBSE Class 10 syllabus such as NLP, computer vision, regression, and classification. Each can be expanded into a complete project report by adding objective, problem statement, dataset description, methodology, results, conclusion, and ethical considerations.