0% found this document useful (0 votes)
15 views23 pages

Yash Yadav Project File (2) - 070431

The document is a practical file certifying that Yash Yadav of DAV Fertilizer Public School has completed an investigatory project under the guidance of Mr. Surendra Singh for the Artificial Intelligence practical examination. It includes various Python programs demonstrating basic programming concepts, data visualization using Matplotlib, and data manipulation with NumPy and Pandas. The document serves as a record of the student's work during the academic session 2023-2024.

Uploaded by

jigyansh25
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
15 views23 pages

Yash Yadav Project File (2) - 070431

The document is a practical file certifying that Yash Yadav of DAV Fertilizer Public School has completed an investigatory project under the guidance of Mr. Surendra Singh for the Artificial Intelligence practical examination. It includes various Python programs demonstrating basic programming concepts, data visualization using Matplotlib, and data manipulation with NumPy and Pandas. The document serves as a record of the student's work during the academic session 2023-2024.

Uploaded by

jigyansh25
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 23

DAV FERTILIZER PUBLIC SCHOOL

BABRALA (SAMBHAL)

PRACTICAL FILE
THIS IS TO CERTIFY THAT YASH YADAV OF CLASS X BR
OF DAV FERTILIZER PUBLIC SCHOOL, BABRALA HAS
SUCCESSFULLY COMPLETED THE INVESTIGATORY
PROJECT FILE UNDER THE GUIDANCE OF Mr.
SURENDRA SINGH DURING THE SESSION 2023-2024.
IN THE PARTIAL FULFILMENT OF ARTIFICIAL
INTELLIGENCE PRACTICAL EXAMINATION CONDUCTED
BY CBSE.

-----------------------------
MR.SURENDRA SINGH
(SUBJECT TEACHER)

1|Page
S.
NO.

1- PYTHON BASICS 3-7


2- MATPLOTLIB 8-14
3- NUMPY 15-16
4- PANDAS 17-18
5- COMPUTER 19-22
VISION

2|Page
I

………………………………………………..
PYTHON BASICS
………………………………………………..
PROGRAM-1- Write a program to find the sum of two number by the
user?
SOURCE CODE-
S1=int(input("WRITE THE NUMBER?"))
S2=int(input("WRITE THE OTHER NUMBER?"))
sum=(S1+S2)
print ("SO THE SUM OF THE NUMBER IS",sum)
OUTPUT-
WRITE THE NUMBER?12
WRITE THE OTHER NUMBER?34
SO THE SUM OF THE NUMBER IS 46

PROGRAM 2- Write a program to find the force applied on a moving


object by taking its its Initial/Final Velocity and time taken by the user?
SOURCE CODE-
u=int(input("Enter The Intail Velocity in m/s "))
v=int(input("Enter The Final Velocity in m/s "))
t=int(input("Enter The Time Taken in s"))
a=(v-u)/t
m=int(input("Enter The Mass Of The Object "))
F=m*a
print("Force Applied= ",F,"N")
OUTPUT-
Enter The Intail Velocity in m/s 47
Enter The Final Velocity in m/s 52
Enter The Time Taken in s45
Acceleration= 0.1111111111111111 m/s
Enter The Intail Velocity in m/s 21
Enter The Final Velocity in m/s 57
Enter The Time Taken in s21
Enter The Mass Of The Object 5
Force Applied= 8.571428571428571 N

3|Page
PROGRAM-3- Write a List and check the number divisible by two?
SOURCE CODE-
l=[23,45,13,96,94]
for l in l:
if l%2==0:
print (l,"NUMBER IS EVEN")
else:
print (l, "NUMBER IS ODD")
OUTPUT-
23 NUMBER IS ODD
45 NUMBER IS ODD
13 NUMBER IS ODD
96 NUMBER IS EVEN
94 NUMBER IS EVEN

PROGRAM-4- Write a List and print the number with their index
number?
SOURCE CODE-
l=[22,45,67,89,6,10]
for i in range(len(l)):
print(i, l[i])
OUTPUT-
0 22
1 45
2 67
3 89
4 6
5 10

PROGRAM-5- Write a program to count the number which is


above 50.
SOURCE CODE-
num=[31,54,13,51,51,32,561,56]
l=len(num)
for i in range(l):
if num[i]<50:
num[i]=50
print(i)
OUTPUT-
7
4|Page
PROGRAM-6-Write a program by taking input from the user and
further calculate whether he/she is capable of the discount or not.
SOURCE CODE-
Amount=int(input("Enter the billing Amount:-"))
gender=input("Gender:-")
if Amount>10000:
if gender=="F":
print("Amount after 15% Discount is",Amount-(0.15*Amount))
else:
print("SORRY! no discount")
OUTPUT-
Enter the billing Amount:-23461
Gender:-F
Amount after 15% Discount is 19941.85

PROGRAM-7-: Program to create a list of following no. and print


all those no. which are in range 40-70.
SOURCE CODE-
num=[13,54,23,98,67,38,56,96,71]
for val in num:
if val>=40and val<=70:
print(val,end=' ')
OUTPUT-
54 67 56

PROGRAM-8- Write a list of numbers and then count


zero,negative and positive number respectively present in the list.
SOURCE CODE-
l=[1,3,0,-5,-9]
cz=0
cp=0
cn=0
for num in l:
if num==0:
cz=cz+1
elif num<0:
cn=cn+1
else:
cp=cp+1
print("Count of Zero=",cz)
5|Page
print("Count of Negative=",cn)
print("Count of Positive=",cp)
OUTPUT-
Count of Zero= 1
Count of Negative= 2
Count of Positive= 2

PROGRAM-9-Write a program by taking input from the user about


his/her PERCENTAGE and check whether he/she is applicable for
the CERTIFICATE OF EXCELLENCE.
SOURCE CODE-
percent = int(input("Enter your percentage : "))
if percent>70:
print("Congratulations")
print("You are awarded- 'Certificate of Excellence'")
else:
print("Study,if not u are paramistic .")
OUTPUT-
Enter your percentage : 92
Congratulations
You are awarded- 'Certificate of Excellence'

PROGRAM-10-Write a program by taking input from the user of


two numbers and now find which one is greater.
SOURCE CODE-
a=int(input("Enter the value of a:-"))
b=int(input("Enter the value of b:-"))
if a<b:
print("a is smaller")
else:
print("b is bigger")
OUTPUT-
Enter the value of a:-65
Enter the value of b:-97
a is smaller

6|Page
PROGRAM-11-Write a program by taking the input by the user and
check whether he/she is eligible for driving or not?
SOURCE CODE-
age=int(input("Enter your age:-"))
if age>=18:
print("Congratulations! You are eligible for driving")
else:
print("Not elligible")
OUTPUT-
Enter your age:-19
Congratulations! You are eligible for driving

PROGRAM-12-Write a program by taking input from the user and


check the number whether it is greater or less than 5.
SOURCE CODE-
num=int (input("Enter a number: "))
rem=num%10
if rem>5:
print("Last digit",num,"is more than 5")
else:
print("Last digit",num,"is less than 5")
OUTPUT-
Enter a number: 6
Last digit is 6 more than 5

7|Page
………………………………………………..
MATPLOTLIB
………………………………………………..
PROGRAM-1-Draw the continuous bar graph showing the
intelligency level of Manessha,Rekha and Seema.
SOURCE CODE-
import matplotlib.pyplot as plt
name=['Maneesha','Rekha','Seema']
intelligency=(99,95,55)
plt.bar(name,intelligency,color='gb',width=1.6)
plt.show( )
OUTPUT-

PROGRAM-2-Draw the BAR GRAPH showing the percentages of 4


different students.
SOURCE CODE-
import matplotlib.pyplot as plt
name=['Lucky','Lakshya','Kalash','Ansh']
percentage=(92.6,97.8,59.2,55.5)
plt.bar(name,percentage,color='gb',width=0.6)
plt.show()

8|Page
OUTPUT-

PROGRAM-3- Write a program to show the sale of AUDI and BMW


in the form of Bar Graph.
SOURCE CODE-
import matplotlib.pyplot as plt import
numpy as np X=np.arange(4)
sale=[[50,40,70,80],[80,20,50,60]]
plt.bar(X,sale[0],label="BMW",color='b',width=0.4)
plt.bar(X+0.4,sale[1],label="Audi",color='g',width=0.4)
plt.xticks(X,[2015,2016,2017,2018])
plt.legend(loc=1)
plt.xlabel('Year')
plt.ylabel('Sale Quantity')
plt.title('Year wise Sale')
plt.show()

9|Page
OUTPUT-

PROGRAM-4- Write a program to show the subject marks of two


students in different years in the form of Bar Graph.
SOURCE CODE-
import matplotlib.pyplot as plt
import numpy as np
X=np.arange(10)
marks=[[10,20,30,40,50,60,70,80,90,100],[10,20,30,40,50,60,70,80,90,100]]
plt.bar(X,marks[0],label="Lakshya",color='b',width=0.4)
plt.bar(X+0.4,marks[1],label="Lucky",color='g',width=0.4)
plt.xticks(X,[2019,2020,2021,2022,2023,2024,2025,2026,2027,2028])
plt.legend(loc=4)
plt.xlabel('Subject')
plt.ylabel('marks')
plt.show()

10 | P a g e
OUTPUT-

PROGRAM-5- Write a program to show the subject marks of two


students in different years in the form of Bar Graph and show their
fluctuations as well.
SOURCE CODE-
import matplotlib.pyplot as plt
import numpy as np
X=np.arange(21)
marks=[[10,20,30,40,50,60,70,80,90,100,200,100,90,80,70,60,50,40,30,20]
,[10,20,30,40,50,60,70,80,90,100,200,100,90,80,70,60,50,40,30,20,10]]
plt.bar(X,marks[0],label="Lakshya",color='b',width=0.4)
plt.bar(X+0.4,marks[1],label="Lucky",color='g',width=0.4)
plt.xticks(X,[2019,2020,2021,2022,2023,2024,2025,2026,2027,2028,2029,20
30,2031,2032,2033,2034,2035,2036,2037,2038,2039])
plt.legend(loc=4)
plt.xlabel('Subject')
plt.ylabel('marks')
plt.show()

11 | P a g e
OUTPUT-

PROGRAM-6- Write a program to show the subject marks of two


students in different years in the form of Bar Graph and show their
fluctuations as well.
SOURCE CODE-
import matplotlib.pyplot as plt
import numpy as np
X=np.arange(20)
marks=[[10,20,30,40,50,60,70,80,90,100,110,120,130,140,150,160,1
70,180,190,200],[10,20,30,40,50,60,70,80,90,100,110,120,130,140,
150,160,170,180,190,200]]
plt.bar(X,marks[0],label="Lakshya",color='b',width=0.4)
plt.bar(X+0.4,marks[1],label="Lucky",color='g',width=0.4)
plt.xticks(X,[2019,2020,2021,2022,2023,2024,2025,2026,2027,2028,
2029,203 0,2031,2032,2033,2034,2035,2036,2037,2038])
plt.legend(loc=4)
plt.xlabel('Subject')
plt.ylabel('marks')
plt.show()

12 | P a g e
OUTPUT-

PROGRAM-7- Write a program to show the subject marks of two


students in different years in the form of Bar Graph.
SOURCE CODE-
import matplotlib.pyplot as plt
import numpy as np
X=np.arange(4)
sale=[[50,40,70,80],[80,20,50,60]]
plt.bar(X,sale[0],label="BMW",color='b',width=0.4)
plt.bar(X+0.4,sale[1],label="Audi",color='g',width=0.4)
plt.xticks(X,[2015,2016,2017,2018])
plt.legend(loc=1)
plt.xlabel('Year')
plt.ylabel('SaleQuantity')
plt.title('YearwiseSale')
plt.show()

13 | P a g e
OUTPUT-

14 | P a g e
………………………………………………..
NUMPY
………………………………………………..
PROGRAM-1- Write a simple program using numpy array.
SOURCE CODE-
import numpy as np
arr = np.array([1, 2, 3, 4, 5])
print(arr)
OUTPUT-
[1 2 3 4 5]

PROGRAM-2-Write a program of numpy having two arrays and


find the sum of these arrays.
SOURCE CODE-
import numpy as np
arr1 = np.array([1, 2, 3])
arr2 = np.array([4, 5, 6])
result = arr1 + arr2
print(result)
OUTPUT-
[5 7 9]

PROGRAM-3-Write a program using numpy and reshape the array.


SOURCE CODE-
import numpy as np
arr = np.array([1, 2, 3, 4, 5, 6])
reshaped_arr = arr.reshape(2, 3)
print(reshaped_arr)
OUTPUT-
[[1 2 3]
[4 5 6]]

15 | P a g e
PROGRAM-4- Write a array and do indexing and slicing over it.
SOURCE CODE-
import numpy as np
arr = np.array([10, 20, 30, 40, 50])
print("Element at index 2:", arr[2])
print("Sliced array from index 1 to 3:", arr[1:4])
OUTPUT-
Element at index 2: 30
Sliced array from index 1 to 3: [20 30 40]

PROGRAM-5- Find mean and sum of the array.


SOURCE CODE-
import numpy as np
arr = np.array([2, 4, 6, 8, 10])
print("Mean:", np.mean(arr))
print("Sum:", np.sum(arr))
OUTPUT-
Mean: 6.0
Sum: 30

16 | P a g e
………………………………………………..
PANDAS
………………………………………………..

PROGRAM-1- Write the name age and grade of three students


using pandas.
SOURCE CODE-
import pandas as pd
data = {'Name': ['Alice', 'Bob', 'Charlie'],
'Age': [15, 16, 15],
'Grade': ['A', 'B', 'A']}
df = pd.DataFrame(data)
print(df)
OUTPUT-
Name Age Grade
0 Alice 15 A
1 Bob 16 B
2 Charlie 15 A

PROGRAM-2- Write the name of three students using pandas and


find the data type also.
SOURCE CODE-
import pandas as pd
data = {'Name': ['Alice', 'Bob', 'Charlie'],
'Age': [15, 16, 15],
'Grade': ['A', 'B', 'A']}
df = pd.DataFrame(data)
print(df['Name'])
OUTPUT-
0 Alice
1 Bob
2 Charlie
Name: Name, dtype: object

17 | P a g e
PROGRAM-3- Write the name age and grade of two students
using pandas.
SOURCE CODE-
import pandas as pd
data = {'Name': ['Alice', 'Bob', 'Charlie'],
'Age': [15, 16, 15],
'Grade': ['A', 'B', 'A']}
df = pd.DataFrame(data)
filtered_df = df[df['Grade'] == 'A']
print(filtered_df)
OUTPUT-
Name Age Grade
0 Alice 15 A
2 Charlie 15 A

PROGRAM-4- Write a program to describe the data collected.


SOURCE CODE-
import pandas as pd
data = {'Name': ['Alice', 'Bob', 'Charlie'],
'Age': [15, 16, 15],
'Grade': ['A', 'B', 'A']}
df = pd.DataFrame(data)
print(df.describe())
OUTPUT-
Age
count 3.000000
mean 15.333333
std 0.577350
min 15.000000
25% 15.000000
50% 15.000000
75% 15.500000
max 16.000000

18 | P a g e
………………………………………………..
COMPUTER VISION
………………………………………………..
PROGRAM-1- Write a program to load a image and give title to
the image as well.
SOURCE CODE-
import cv2
import matplotlib.pyplot as plt
import numpy as np
img = cv2.imread('Images/man.jpg')
plt.imshow(img)
plt.title('man')
plt.axis('off')
plt.show()
OUTPUT-

PROGRAM-2- Write a program to load a image and print axis


along with the title at the top.
SOURCE CODE-
img = cv2.imread('Images/rgb.png')
plt.imshow(cv2.cvtColor(img, cv2.COLOR_BGR2RGB));
plt.axis('on');
19 | P a g e
plt.title('RGB')
plt.show()
print(img.shape)
[B,G,R] = img[100, 100]
print('R=', R, 'G=', G, 'B=',B)

OUTPUT-

PROGRAM-3- Write a program to focus the image of the face of


a man.
SOURCE CODE-
roi = img[1500:2500,1000:2000]
plt.imshow(cv2.cvtColor(roi, cv2.COLOR_BGR2RGB))
plt.title('man')
plt.axis('on')
plt.show()

20 | P a g e
OUTPUT-

PROGRAM-4- Write a program to extract some part of a image.


SOURCE CODE-
img = cv2.imread('Images/man.jpg') jack =
img[3500:3900, 1000:1500]
plt.imshow(cv2.cvtColor(jack, cv2.COLOR_BGR2RGB))
plt.title('jack')
plt.axis('off')
plt.show()
OUTPUT-

21 | P a g e
PROGRAM-5- Write a program to load a image and label it as per
its name.
SOURCE CODE-
import cv2
import matplotlib.pyplot as plt
import numpy as np
img = cv2.imread('Images/flower.jpg')
plt.imshow(img)
plt.title('Flower')
plt.axis('off')
plt.show()
OUTPUT-

22 | P a g e

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy