Practical-File-Sample
Practical-File-Sample
Practical-File-Sample
OF
ARTIFICIAL INTELLIGENCE (417)
SESSION 2021-22
BY :
NAME- BHUMIKA KAUSHIK
ROLL NO-12102214
UNDER GUIDANCE OF
MR. JAY KUMAR BHAGWANI
FOR PARTIAL FULFILMENT OF
CLASS-X
SUBMITTED TO-
ACKNOWLEDGEMENT
I am greatly indebted to my Teacher Mr. Jay Kumar Bhagwani
for his effervescent, encouragement and for constructive
guidance. I would like to express my gratitude to him for
making me proficient in learning and understanding through
Python and helping me a lot in completing my work and
assignment.
I also give thanks to respected principal sir Mr. Shalabh Nigam
without whose co-operation this practical work wouldn’t have
been completed.
I am heartedly thankful to my parents, my family and my
classmates who helped me through my work.
1.# Python Program to find Total, Average, and Percentage of Five Subjects
average = total / 5
OUTPUT- 1
OUTPUT- 2
2.# Program to convert the currency from rs. To dollar or vice versa.
inr = usd * 73
print("The currency in INR is",round(inr,2))
&
usd = inr/73
OUTPUT-1
OUTPUT-2
if (num % 2 != 0):
print("Number is odd")
else:
print("Number is even")
OUTPUT-1
Number is even
OUTPUT-2
Number is odd
b)1
12
123
print("")
OUTPUT-1
12
123
1234
12345
OUTPUT-2
12
for i in range(2,int(num/2)+1):
if(num % i) == 0:
else:
else:
OUTPUT-1
17 is a prime number
OUTPUT-2
6.# Program to display the table of a given number in the following format :
for i in range(1,6):
print(table,"*",i,"=",table*i)
OUTPUT-1
4*1=4
4*2=8
4 * 3 = 12
4 * 4 = 16
4 * 5 = 20
OUTPUT-2
2*1=2
2*2=4
2*3=6
2*4=8
2 * 5 = 10
> = 90 A1
>=80 A2
>=70 B1
>=60 B2
>=50 C1
>=40 C2
>=33 D
<=33 E
print("A1")
print("A2")
print("B1")
print("B2")
print("C1")
print("C2")
print("D")
else:
print("E")
OUTPUT-1
A2
OUTPUT-2
factorial = 1
if num == 0:
else:
factorial = factorial*i
OUTPUT-1
Enter a number: 6
The factorial of 6 is 1
The factorial of 6 is 2
The factorial of 6 is 6
The factorial of 6 is 24
OUTPUT-2
Enter a number: 4
The factorial of 4 is 1
The factorial of 4 is 2
The factorial of 4 is 6
The factorial of 4 is 24
9.# Program to calculate the discount Total amount > 10000 (20% ) >5000 (10%)
<5000 (5%)
else:
OUTPUT-1
OUTPUT-2
a) 1 + 2 + 3 + ………..
b) 2 + 4 + 6 + ……..
c) ½ + ¼ + 1/6 + ……
num=int(input("enter the number for upto which series should go:"))
sum= (num/2)*(2+(num-1))
OUTPUT-1
OUTPUT-2
fruitlist=["Apple","Banana","Pineapple","Orange"]
fruitlist.append("Guava")
print(fruitlist)
OUTPUT
fruitlist=["Apple","Banana","Pineapple","Orange"]
fruitlist.insert(1,"Mango")
print(fruitlist)
OUTPUT
fruitlist=["Apple","Banana","Pineapple","Orange"]
fruitlist.pop()
print(fruitlist)
OUTPUT
fruitlist=["Orange","Banana","Pineapple","Apple"]
fruitlist.sort()
print(fruitlist)
OUTPUT
12.# Create a tuple and write the commands associated with tuple.
(i) colours=("red","black","blue","green","yellow","pink")
print(colours)
OUTPUT-
print(len(colours))
OUTPUT-
(iii) colours=("red","black","blue","green","yellow","pink")
del(colours)
OUTPUT-
Nothing
(iv) colours=("red","black","blue","green","yellow","pink")
print(type(colours))
OUTPUT-
<class 'tuple'>
print(my_dict)
OUTPUT-
my_dict[6]="science"
print(my_dict)
OUTPUT-
my_dict.pop(3)
print(my_dict)
OUTPUT-
del my_dict
OUTPUT-
Nothing
print(len(my_dict))
OUTPUT-
print(type(my_dict))
OUTPUT-
<class 'dict'>
print(myset)
OUTPUT-
myset.add(2)
print(myset)
OUTPUT-
myset.remove("ram")
print(myset)
OUTPUT-
15.# Program to find out the largest number out of three numbers.
OUTPUT- 1
OUTPUT- 2
n1, n2 = 0, 1
count = 0
if nterms <= 0:
print("Please enter a positive integer")
elif nterms == 1:
print(n1)
else:
print("Fibonacci sequence:")
print(n1)
nth = n1 + n2
n1 = n2
n2 = nth
count += 1
OUTPUT- 1
Fibonacci sequence:
13
21
34
OUTPUT- 2
n=int(input("Enter a number:"))
tot=0
while(n>0):
dig=n%10
tot=tot+dig
n=n//10
OUTPUT- 1
Enter a number:22
OUTPUT- 2
Enter a number:484
sname=input("Student's Name:")
admNo=input("Admission No.")
fname=input("Father's Name:")
mname=input("Mother's Name:")
gender=input("Gender:")
sclass=input("Class:")
eng=float(input("English marks:"))
hin_sans=float(input("Hindi/Sanskrit marks:"))
maths=float(input("Maths marks:"))
science=float(input("Science marks:"))
ssc=float(input("SSc marks:"))
ai=float(input("AI marks:"))
total=eng+hin_sans+maths+science+ssc+ai
percent=(eng+hin_sans+maths+science+ssc+ai)/6
grade=""
if percent>=90:
grade="Excellent"
elif percent>=75:
grade="Very good"
elif percent>=60:
grade="Good"
elif percent>=45:
grade="Average"
elif percent>=33:
grade="Poor"
else:
grade="Fail"
print("***************************************************************** *********************************")
print("------------------------------------------------------------------------------------------------------------------------------------------------------------------")
print("------------------------------------------------------------------------------------------------------------------------------------------------------------------")
max=100
min=33
print("Subject","\t","Max","\t","Min","\t","Marks Obt.")
print("English","\t",max,"\t",min,"\t",eng)
print("Hindi/Sans",max,"\t",min,"\t",hin_sans)
print("Maths","\t",max,"\t",min,"\t",maths)
print("Science","\t",max,"\t",min,"\t",science)
print("SSc ","\t",max,"\t",min,"\t",ssc)
print("AI ","\t",max,"\t",min,"\t",ai)
print("-----------------------------------------------------------------------------------------------------------------------------------------------------------------")
print("Total Marks:","\t","\t","\t",total)
print("Percentage:","\t","\t","\t",percent)
print("Grade: ","\t","\t","\t",grade)
print("-----------------------------------------------------------------------------------------------------------------------------------------------------------------")
OUTPUT
Admission No.181550
Gender:FEMALE
Class:10th
English marks:96
Hindi/Sanskrit marks:99
Maths marks:100
Science marks:97
SSc marks:94
AI marks:99.5
***************************************************************** *********************************
------------------------------------------------------------------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------------------------------------------------------------
AI 100 33 99.5
-----------------------------------------------------------------------------------------------------------------------------------------------------------------
Percentage: 97.58333333333333
Grade: Excellent
-----------------------------------------------------------------------------------------------------------------------------------------------------------------
Principal Signature