Little Angels School, Sonipat
Practical File
of
Artificial Intelligence
Submitted by:- Submitted to:-
Name ______________ ______________
Class/Sec ______________
Rollno ______________
Contents
Sr No Programs
1 Write a program in python to calculate simple interest.
2 Write a program in python to calculate product of two numbers.
3 Write a program in python to perimeter of rectangle.
4 Write a program in python to calculate average of marks of three subjects.
5 Write a program in python to find that entered number is even or odd.
6 Write a program in python to find that entered year is leap year or not
7 Write a program in python to find that entered number is positive or
negative.
8 Write a program in python to find that entered number is positive ,
negative or zero.
9 Write a program in python to find greatest among three numbers.
10 Write a program in python to print series from 1 to 10.
11 Write a program in python to print even series from 2 to 20.
12 Write a program to find sum of ten natural number.
13 Write a program to find square of numbers from 1 to 10
14. Write a program to display image of flower.
1. Write a program in python to calculate simple interest.
p=int(input("Enter principal amount: "))
r=int(input("Enter rate of interest: "))
t=int(input("Enter time period(years): "))
si=(p*r*t)/100
print("Simple Interest", si)
Output:-
2. Write a program to calculate product of two numbers.
x=int(input("Enter no 1: "))
y=int(input("Enter no 2: "))
z=x*y
print(z)
Output:-
3. Write a program to find perimeter of rectangle.
l=int(input("enter length"))
b=int(input("enter breadth"))
p=2*(l+b)
print("perimeter =",p)
Output:-
4. Write a program to find average of marks of three
subjects.
e = int(input(“enter marks of English”))
m = int(input(“enter marks of Maths”))
h= int(input(“enter marks of Hindi”))
average=(e+m+h)/3
print(average)
output:-
5. Write a program to find that entered number is even or
odd.
no=int(input("enter No : "))
if (no % 2 == 0):
print("Even No")
else:
print("Odd No")
Output:-
6. Write a program to find that entered year is leap year or
not.
year=int(input("enter year(4 digit) : "))
if (year % 4 == 0):
print("Leap Year")
else:
print("Not Leap Year")
Output:-
7. Write a program to find that entered number is positive or
negative.
no=int(input("enter No : "))
if (no >= 0):
print("Positive Number")
else:
print("Negative Number")
Output:-
8. Write a program to find positive ,negative or zero.
no=int(input("enter No : "))
if (no >= 0):
print("Number is positive No")
elif(no<0):
print("Number is negative No")
else:
print(“Number is zero”)
Output:-
9. Write a program to find greatest among three numbers
a=int(input("enter first number"))
b=int(input("enter second number"))
c=int(input("enter third number"))
if(a>b) and (a>c):
print("first number is greater")
elif(b>a) and (b>c):
print("second number is greater")
else:
print("third number is greater")
output:-
10. Write a program to print numbers from 1 to 10.
for a in range(1,11,1):
print(a)
Output:-
11. Write a program to print even numbers 2 to 20.
for a in range(2,21,2):
print(a)
Output:-
12. Write a program to find sum of 10 natural numbers.
sum=0
for a in range(1,11,1):
sum = sum+a
print(sum)
Output:-
13. Write a program to find square of numbers from 1 to 10
by using while loop.
a=1
while a<=10:
square = a**2
print(square)
a+=1
Output:-
14. Write a program to display image of flower.
import cv2
import numpy as np
import matplotlib.pyplot as plt
img=cv2.imread("C:/Users/Desktop/flower.jpg")
plt.imshow(img)
plt.title(" My picture")
plt.show()
Output:-