Name: Vaibhav Singh Kunwar
10th Hilltop
Vaibhav Singh Kunwar 10th Hilltop
2025 2026
Ms. Puja Shah Dahiya
INDEX <INDEX/
1. Print the name
> given
[Link] to count number of
by user to input items in a list
2. To check whether a 12. Program to find sum of
number is even or odd numbers in a list
[Link] to revise order of a
3. Find largest number among list of numbers
three inputs
14. To find out whether a
particular string is palindrome
4. Find factorial of number
given by user 15. To generate Fibonacci
Sequence
5. Display the multiplication 16. To create and display list of
table of a given number elements
6. To find the sum of first 17. To find out average of
‘n’ natural numbers elements in a list
18. Append a new element to
7. Check whether a person is existing list
eligible to vote
[Link] to remove an
8. To find out whether a element from a list
year is a leap year 20. To find out whether a
number is prime or not
9. Check whether a number
is Armstrong number
10. To convert temperature
from Celsius to Fahrenheit
Python programs
1.) Write a program to print the name
given by the user as input.
Program:
Output:
2.) Write a program to check Whether a
given number is even or odd
Program:
Output:
Q3.) Write a program to find the
largest number among three input
numbers.
Program:
Output:
4.) Find the factorial of a number
given by user
Program:
Output:
5.) Display the multiplication table of a
number given by user.
Program:
Output:
6.) To find out the sum of first ‘n’
Natural Numbers
Program:
Output:
7.) Check whether a person is eligible
to vote
Program:
Output:
8.) To find out whether a year is a leap
year.
Program:
Output:
9.) Check whether a number is
Armstrong Number
Program:
Output:
10.) To convert a temperature in
Celsius to Fahrenheit
Program:
Output:
11.) Write a program to count the
number of items in a list
Program:
Output:
Output:
12.) write a program to find the sum, of
all the numbers in a list.
Program:
Output:
13.) Write a program to reverse order
of a list of number
Program:
Output:
14.) To find out whether a particular
string is a palindrome
Program:
Output:
15.) write a program to generate
Fibonacci Sequence
Program:
Output:
16.) To create and display a list of
elements
Program:
Output:
17.) To find out the average of elements in a list .
Program:
Output:
18.) Append a new element to an
Existing List
Program:
Output:
19.) Write a program to remove an element from a list
Program:
Output:
20.) To find out whether a number is prime .
Program:
Output:
\
PROJECT :1
Introduction to Data
Visualization
What is data visualization?
Data visualization is the graphical representation of information and data. By using visual elements
like charts, graphs, and maps, data visualization tools provide an accessible way to see and
understand trends, outliers, and patterns in data. Additionally, it provides an excellent way for
employees or business owners to present data to non-technical audiences without confusion.
In the world of Big Data, data visualization tools and technologies are essential to analyze massive
amounts of information and make data-driven decisions.
PRACTICAL
Tools: Python, Matplotlib, (optional Pandas)
Prerequisites: Basic Python syntax – variables, lists, loops.
Learning Objectives
1. Explain what data visualization is and why it’s important.
2. Read data from a list or file in Python.
3. Create bar charts, line charts, and pie charts using Matplotlib.
4. Customize visuals with labels, colors, and titles.
5. Draw conclusions from simple datasets.
Session 1 – Introduction to Data Visualization
Topics:
What is data visualization?
Real-world examples (news charts, weather apps, business dashboards).
Activity:
Show different chart types – bar, line, pie – and discuss what story each tells.
Assignment:
Students find one chart from the news or social media and explain what it shows.
Session 2 – Creating a Simple Bar Chart
import [Link] as plt
subjects = ["Math", "Science", "English", "Computers"]
marks = [88, 92, 80, 95]
[Link](subjects, marks, color="skyblue")
[Link]("My Exam Scores")
[Link]("Subjects")
[Link]("Marks")
[Link]()
Expected Output:
Concepts: Bar chart = compare quantities.
Session 3 – Plotting Line Graphs
import [Link] as plt
months = ["Jan", "Feb", "Mar", "Apr", "May"]
temperature = [25, 28, 32, 35, 33]
[Link](months, temperature, marker='o', linestyle='-',
color='green')
[Link]("Monthly Temperature Trend")
[Link]("Month")
[Link]("Temperature (°C)")
[Link]()
Expected Output:
Concepts: Line graph = show change over time.
PROJECT :2
Teachable Machine
Teachable Machine Programs
Platform: [Link]
Duration: 3–4 sessions
Objective: Students will train their own simple AI models to recognize images using
Teachable Machine and apply them in real life.
Program 1 – Image Classification (Objects)
Goal: Train an AI model to recognize 2–3 classroom objects.
Steps:
1. Go to Teachable Machine → Image Project → Standard Image Model.
2. Create three classes, e.g.
o Class 1 = Pen
o Class 2 = Notebook
o Class 3 = Bottle
3. For each class, click Webcam or Upload and add at least 30–50 images showing the
object in different angles and lighting.
4. Click Train Model.
5. When training finishes, click Preview and test by showing each object to the webcam.
6. Export the model (click “Export Model → [Link]”) to use in a website or app.
Expected Output:
The model correctly identifies which object the webcam sees.
E.g., shows “Notebook – 95% confidence” when you hold a notebook.
Program 2 – Emotion / Expression Detection
Goal: Train a model to recognize human facial expressions.
Steps:
1. New Project → Image Project → Standard Image Model.
2. Create two or three classes:
o Class 1 = Happy
o Class 2 = Sad
o (Optional Class 3 = Surprised)
3. Capture 30–40 images of yourself or classmates showing each expression.
4. Train the model.
5. Test live via webcam.
Expected Output:
When you smile, the output shows “Happy ✅”; when you frown, it changes to “Sad”.
🧾 Observation Sheet Example
Program Classes Used Dataset Size Accuracy Comments
Image Classification Pen, Notebook, Bottle 150 images 94 % Works best in bright light
Emotion Detection Happy, Sad 90 images 89 % Model confused by dim light
📘 Learning Outcomes
Understand the concept of training data and labels.
Learn how machines learn patterns from images.
Gain awareness of bias (why a model might misclassify).
Encourage creative use of AI in daily life.
PROJECT :3
TOPIC : “Generate TFIDF values for all the
words and find the words having the highest
value”
Introduction: TF-IDF
TF-IDF stands for “Term Frequency — Inverse Document
Frequency”. This is a technique to quantify words in a set of documents.
We generally compute a score for each word to signify its importance in
the document and corpus. This method is a widely used technique in
Information Retrieval and Text Mining.
If I give you a sentence for example “This building is so tall”. It's easy for
us to understand the sentence as we know the semantics of the words
and the sentence. But how can any program (eg: python) interpret this
sentence? It is easier for any programming language to understand
textual data in the form of numerical value. So, for this reason, we need
to vectorize all of the text so that it is better represented.
By vectorizing the documents we can further perform multiple tasks such
as finding the relevant documents, ranking, clustering, etc. This exact
technique is used when you perform a google search (now they are
updated to newer transformer techniques). The web pages are called
documents and the search text with which you search is called a query.
The search engine maintains a fixed representation of all the documents.
When you search with a query, the search engine will find the relevance
of the query with all of the documents, ranks them in the order of
relevance and shows you the top k documents. All of this process is done
using the vectorized form of query and documents.
Now coming back to our TF-IDF,
TF-IDF = Term Frequency (TF) * Inverse Document Frequency (IDF)
Terminology
● t — term (word)
● d — document (set of words)
● N — count of corpus
● corpus — the total document set
Term Frequency
This measures the frequency of a word in a document. This highly
depends on the length of the document and the generality of the word,
for example, a very common word such as “was” can appear multiple
times in a document. But if we take two documents with 100 words and
10,000 words respectively, there is a high probability that the common
word “was” is present more in the 10,000 worded document. But we
cannot say that the longer document is more important than the shorter
document. For this exact reason, we perform normalization on the
frequency value, we divide the frequency with the total number of words
in the [Link] that we need to finally vectorize the document.
When we plan to vectorize documents, we cannot just consider the words
that are present in that particular document. If we do that, then the
vector length will be different for both the documents, and it will not be
feasible to compute the similarity. So, what we do is that we vectorize the
documents on the vocab. Vocab is the list of all possible worlds in the
[Link] need the word counts of all the vocab words and the length of
the document to compute TF. In case the term doesn’t exist in a
particular document, that particular TF value will be 0 for that particular
document. In an extreme case, if all the words in the document are the
same, then
TF will be 1. The final value of the normalised TF value will be in the
range of [0 to 1]. 0, 1 [Link] is individual to each document and
word, hence we can formulate TF as follows:tf(t,d) = count of t in d /
number of words in dIf we already computed the TF value and if this
produces a vectorized form of the document, why not use just TF to find
the relevance between documents? Why do we need IDF?
Let me explain, words which are most common such as ‘is’, ‘are’ will
have very high values, giving those words very high importance. But
using these words to compute the relevance produces bad results. These
kinds of common words are called stop-words. Although we will remove
the stop words later in the preprocessing step, finding the presence of
the word across the documents and somehow reduce their weightage is
more ideal.
Document Frequency
This measures the importance of documents in a whole set of the corpus.
This is very similar to TF but the only difference is that TF is the
frequency counter for a term t in document d, whereas DF is the count
of occurrences of term t in the document set N. In other words, DF is
the number of documents in which the word is present. We consider one
occurrence if the term is present in the document at least once, we do
not need to know the number of times the term is present.
df(t) = occurrence of t in N documents
To keep this also in a range, we normalize by dividing by the total
number of documents. Our main goal is to know the informativeness of a
term, and DF is the exact inverse of it. that is why we inverse the DF
Inverse Document Frequency
IDF is the inverse of the document frequency which measures the
informativeness of term t. When we calculate IDF, it will be very low for
the most occurring words such as stop words (because they are present
in almost all of the documents, and N/df will give a very low value to that
word). This finally gives what we want, a relative weightage.
idf(t) = N/df
Now there are few other problems with the IDF, when we have a large
corpus size say N=10000, the IDF value explodes. So to dampen the
effect we take the log of [Link] query time, when the word is not present
in is not in the vocab, it will simply be ignored. But in few cases, we use a
fixed vocab and few words of the vocab might be absent in the document,
in such cases, the df will be 0. As we cannot divide by 0, we smoothen the
value by adding 1 to the denominator.
idf(t) = log(N/(df + 1))
Finally, by taking a multiplicative value of TF and IDF, we get the TF-IDF
score. There are many different variations of TF-IDF but for now, let us
concentrate on this basic version.
tf-idf(t, d) = tf(t, d) * log(N/(df + 1))
Implementing on a real-world dataset
Now that we learnt what is TF-IDF let us compute the similarity score on
a [Link] dataset we are going to use are archives of few stories, this
dataset has lots of documents in different formats. Download the dataset
and open your notebooks, Jupyter Notebooks I mean 😜.
Step 1: Analysing Dataset
The first step in any of the Machine Learning tasks is to analyse the data.
So if we look at the dataset, at first glance, we see all the documents with
words in English. Each document has different names and there are two
folders in it.
Now one of the important tasks is to identify the title in the body, if we
analyse the documents, there are different patterns of alignment of title.
But most of the titles are centre aligned. Now we need to figure out a
way to extract the title. But before we get all pumped up and start
coding, let us analyse the dataset little deep.
Take few minutes to analyse the dataset yourself. Try to explore…
Upon more inspection, we can notice that there’s an [Link] in each
folder (including the root), which contains all the document names and
their titles. So, let us consider ourselves lucky as the titles are given to
us, without exhaustively extracting titles from each document.
Step 2: Extracting Title & Body:
There is no specific way to do this, this totally depends on the problem
statement at hand and on the analysis, we do on the dataset.
As we have already found that the titles and the document names are in
the [Link], we need to extract those names and titles. We are lucky
that [Link] has tags that we can use as patterns to extract our
required content.
Step 3: Preprocessing
Preprocessing is one of the major steps when we are dealing with any
kind of text model. During this stage, we have to look at the distribution
of our data, what techniques are needed and how deep we should clean.
This step never has a one-hot rule, and totally depends on the problem
statement. Few mandatory preprocessing are: converting to lowercase,
removing punctuation, removing stop words and
lemmatization/stemming. In our problem statement, it seems like the
basic preprocessing steps will be sufficient.
Lowercase
During the text processing, each sentence is split into words and each
word is considered as a token after preprocessing. Programming
languages consider textual data as sensitive, which means that The is
different from the. we humans know that those both belong to the same
token but due to the character encoding those are considered as different
tokens. Converting to lowercase is a very mandatory preprocessing step.
As we have all our data in the list, numpy has a method that can convert
the list of lists to lowercase at once.
[Link](data)
Stop words
Stop words are the most commonly occurring words that don’t give any
additional value to the document vector. in-fact removing these will
increase computation and space efficiency. nltk library has a method to
download the stopwords, so instead of explicitly mentioning all the
stopwords ourselves we can just use the nltk library and iterate over all
the words and remove the stop words. There are many efficient ways to
do this, but ill just give a simple method.
Punctuation
Punctuation is the set of unnecessary symbols that are in our corpus
documents. We should be a little careful with what we are doing with
this, there might be few problems such as U.S — us “United Stated”
being converted to “us” after the preprocessing. hyphen and should
usually be dealt with little care. But for this problem statement, we are
just going to remove these
symbols = "!\"#$%&()*+-./:;<=>?@[\]^_`{|}~\n"
for i in symbols:
data = [Link](data, i, ' ')
We are going to store all our symbols in a variable and iterate that
variable removing that particular symbol in the whole dataset. we are
using numpy here because our data is stored in a list of lists, and numpy
is our best bet.
Apostrophe
Note that there is no ‘ apostrophe in the punctuation symbols. Because
when we remove punctuation first it will convert don’t to dont, and it is a
stop word that won't be removed. What we will do instead, is removing
the stop words first followed by symbols and then finally repeat stopword
removal as few words might still have an apostrophe that are not
stopwords.
return [Link](data, "'", "")
Single Characters
Single characters are not much useful in knowing the importance of the
document and few final single characters might be irrelevant symbols, so
it is always good to remove the single characters.
new_text = ""
for w in words:
if len(w) > 1:
new_text = new_text + " " + w
We just need to iterate to all the words and not append the word if the
length is not greater than 1.
Stemming
This is the final and most important part of the preprocessing. stemming
converts words to their stem.
For example, playing and played are the same type of words that
basically indicate an action play. Stemmer does exactly this, it reduces
the word to its stem. we are going to use a library called porter-stemmer
which is a rule-based stemmer. Porter-Stemmer identifies and removes
the suffix or affix of a word. The words given by the stemmer need not be
meaningful few times, but it will be identified as a single token for the
model.
Lemmatisation
Lemmatisation is a way to reduce the word to the root synonym of a
word. Unlike Stemming, Lemmatisation makes sure that the reduced
word is again a dictionary word (word present in the same language).
WordNetLemmatizer can be used to lemmatize any word.
Stemming vs Lemmatization
stemming — need not be a dictionary word, removes prefix and affix
based on few rules
lemmatization — will be a dictionary word. reduces to a root synonym.
A better efficient way to proceed is to first lemmatise and then stem, but
stemming alone is also fine for few problems statements, here we will not
lemmatise.
Converting Numbers
When a user gives a query such as 100 dollars or hundred dollars. For
the user, both those search terms are the same. but our IR model treats
them separately, as we are storing 100, dollars, hundred as different
tokens. So to make our IR mode a little better we need to convert 100 to
hundred. To achieve this we are going to use a library called num2word.
If we look a little close to the above output, it is giving us few symbols
and sentences such as “one hundred and two”, but damn we just cleaned
our data, then how do we handle this? No worries, we will just run the
punctuation and stop words again after converting numbers to words.
Preprocessing
Finally, we are going to put in all those pre-processing methods
If you look closely, a few of the pre-processing methods are repeated
again. As discussed, this just helps clean the data little deep. Now we
need to read the documents and store their title and the body separately
as we are going to use them later. In our problem statement, we have
very different types of documents, this can cause few errors in reading
the documents due to encoding compatibility. to resolve this, just use
encoding=”utf8", errors=’ignore’ in the open() method.
Step 3: Calculating TF-IDF
To generate TF-IDF (Term Frequency-Inverse Document Frequency)
values for the words in the text, we need to follow these steps:
1. Preprocess the text: Tokenize the text, remove stop words, and
normalize words (e.g., convert to lowercase, remove punctuation).
2. Calculate Term Frequency (TF): Count the frequency of each
word in the document.
3. Calculate Inverse Document Frequency (IDF): Since we only
have one document, we typically set IDF to 1 (or calculate based on
a corpus if available).
4. Compute TF-IDF: Multiply TF and IDF values for each word.
I'll compute this for the provided text.
Analyzed
The words with the highest TF-IDF values in the given text are:
1. pollution: 0.410391
2. air: 0.307794
3. like: 0.205196
4. delhi: 0.205196
5. making: 0.102598
6. manufacturing: 0.102598
7. national: 0.102598
8. near: 0.102598
9. known: 0.102598
10. people: 0.102598
These words have the highest relevance in the context of the text based
on TF-IDF values.
TF-IDF(document) = TF-IDF(title) * alpha + TF-IDF(body) * (1-alpha)
Calculating TF-IDF
Recall that we need to maintain different weights for title and body. To
calculate TF-IDF of body or title we need to consider both the title and
body. To make our job a little easier, let’s use a dictionary
with (document, token) pair as key and any TF-IDF score as the value.
We just need to iterate over all the documents, we can use the Coutner
which can give us the frequency of the tokens, calculate tf and idf and
finally store as a (doc, token) pair in tf_idf. tf_idf dictionary is for the
body, we will use the same logic to build a dictionary tf_idf_title for the
words in the title.
PROJECT REPORT
● NAME OF THE SOFTWARE : [Link]
(SOFTWARE USED FOR THIS PROJECT )
● DOCUMENTS USED :
Document 1
Mr. and Mrs. Dursley, of number four, Privet Drive, were proud to say that they were
perfectly normal, thank you very much. They were the last people you’d expect to be
involved in anything strange or mysterious, because they just didn’t hold with such nonsense.
Document 2
Mr. Dursley was the director of a firm called Grunnings, which made drills. He was a big,
beefy man with hardly any neck, although he did have a very large mustache. Mrs. Dursley
was thin and blonde and had nearly twice the usual amount of neck, which came in very
useful as she spent so much of her time craning over garden fences, spying on the neighbors.
The Dursleys had a small son called Dudley and in their opinion there was no fi ner boy
anywhere.
Document 3
When Mr. and Mrs. Dursley woke up on the dull, gray Tuesday our story starts, there was
nothing about the cloudy sky outside to suggest that strange and mysterious things would
soon be happening all over the country. Mr. Dursley hummed as he picked out his most
boring tie for work, and Mrs. Dursley gossiped away happily as she wrestled a screaming
Dudley into his high chair.
OUT PUT GIVEN BY THE SOFTWARE