0% found this document useful (0 votes)
5 views

PRACTICAL FILE_X.

class notes
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)
5 views

PRACTICAL FILE_X.

class notes
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/ 11

VIDYA MANDIR PUBLIC

SCHOOL

ARTIFICIAL INTELLIGENCE
PRACTICAL FILE

Name:___________________________

Class & Sec:_________________

Roll No.:____________________
Sn INDEX
o.
1 WAP to accept the length and breadth of a rectangle. Calculate and print its area
and perimeter.
WAP to calculate the distance covered by car if the speed and time is entered by user.
2
Write a Python program to accept the marks in five subjects. Print total and
3
average
4 WAP to find number of years and days if the total number of days are entered by
user.
5 WAP to accept the CP and SP of an article. Print whether it is profit or loss.
6 WAP to check whether no is even or odd.
7 WAP to enter the three sides of triangle and print it is equilateral triangle.
8 WAP to accept the percentage of student and print it is “PASS” or “FAIL”
9 WAP to print number from 1 to 10 using for loop.
10 WAP to print even numbers from 2 to 30 using for loop.

11 WAP to print odd numbers from 1 to n using for loop.


12 WAP to print sum from 1 to n using for loop.
13 WAP to print even numbers from 4 to 40 using while loop.
14 WAP to print odd numbers from 3 to 30 using while loop.
15 WAP to create the list of n elements and elements are entered by user.
16 WAP to insert the new element at end of the list.
17 WAP to find the mean of the list.

18 WAP to insert the new list at the end of list.


19 WAP to print the total number of items present in the list.
20 WAP to find the largest element of the list.
PROGRAM:1
WAP to accept the length and breadth of a rectangle. Calculate and print its area
and perimeter.
l=int(input(“Enter the length”))

b=int(input(“Enter the breadth”))

ar=l*b

print(“area of rectangle is”,ar)

p=2*(l+b)

print(“Perimeter of square is”,p)

OUTPUT
Enter the length:4

Enter the breadth:6

area of rectangle is 24

Perimeter of square is 20

********************************************************************************
PROGRAM:2
WAP to calculate the distance covered by car if the speed and time is entered by
user.
s=int(input(“Enter the speed”))

t=int(input(“Enter the time”))

d=s*t

print(“distance covered is”,d)

OUTPUT
Enter the speed:4

Enter the time:6

distance covered is:24

********************************************************************************

PROGRAM:3

Write a Python program to accept the marks in five subjects. Print total and
average
S1= int(input(“Enter the marks of first subject”))

S2= int(input(“Enter the marks of second subject”))

S3= int(input(“Enter the marks of first subject”))

S4= int(input(“Enter the marks of first subject”))

S5= int(input(“Enter the marks of first subject”))

Total=S1+S2+S3+S4+S5

Avg=total/5

print(“total and average marks:”,Total,Avg)

OUTPUT
Enter the marks of first subject:56

Enter the marks of second subject:45

Enter the marks of third subject:45

Enter the marks of fourth subject:45

Enter the marks of fifth subject:45

total and average marks:200,40


PROGRAM:4
WAP to find number of years and days if the total number of days are entered by user.

d=int(input(“Enter the total days”))

yr=d/365

days_left=d%365

print(“No of year”,d)
print(“No of days left”, yr)

OUTPUT
Enter the total

days:725

No of year 2

No of days left 5

********************************************************************************

PROGRAM:5

WAP to accept the CP and SP of an article. Print whether it is profit or loss.


cp=int(input(“Enter the cost price:”))

sp=int(input(“Enter the selling price:”))

if (cp>sp):

print(“LOSS”)

else:

print(“PROFIT”)

OUTPUT

Enter the cost price:45

Enter the selling price:98

PROFIT

********************************************************************************
PROGRAM:6
WAP to check whether no is even or odd.
n=int(input(“Enter the number:”))

if (n%2==0):

print(“NUMBER IS EVEN”)

else:

print(“NUMBER IS ODD”)

OUTPUT

Enter the number:12

NUMBER IS EVEN

Enter the number:5

NUMBER IS ODD

********************************************************************************

PROGRAM:7
WAP to enter the three sides of triangle and print it is equilateral triangle.
a=int(input(“Enter the first side:”))

b=int(input(“Enter the second side:”))

c=int(input(“Enter the third side:”))

if a==b==c:

print(“TRIANGLE IS EQUILATERAL”)

else:

print(“TRIANGLE IS NOT EQUILATERAL”)

OUTPUT

Enter the first side:15

Enter the second side:15

Enter the third side:15

TRIANGLE IS EQUILATERAL

********************************************************************************
PROGRAM:8
WAP to accept the percentage of student and print it is “PASS” or “FAIL”
p=int(input(“Enter the percentage:”))

if (p>35):

print(“PASS”)

else:

print(“FAIL”)

OUTPUT
Enter the percentage:65

PASS

Enter the percentage:30

FAIL

********************************************************************************

PROGRAM:9
WAP to print number from 1 to n using for loop.

n=int(input(“enter the number”))


for i in range(n):
print(i)

OUTPUT:
enter the number:4
1
2
3
4

********************************************************************************
PROGRAM:10
WAP to print even numbers from 2 to n using for loop.

n=int(input(“enter the number”))


for i in range(2,n+1,2):
print(i)

OUTPUT:
enter the number:6
2
4
6

********************************************************************************

PROGRAM:11

WAP to print odd numbers from 1 to n using for loop.

n=int(input(“enter the number”))


for i in range(1,n+1,2):
print(i)

OUTPUT:
enter the number:7
1
3
5
7
********************************************************************************

PROGRAM:12
WAP to print sum from 1 to n using for loop.

n=int(input(“enter the number”))


sum=0
for i in range(1,n+1):
sum=sum+i
print(“TOTAL SUM IS”,sum)

OUTPUT:
enter the number 4
TOTAL SUM IS 10

********************************************************************************
PROGRAM:13
WAP to print even numbers from 4 to n using while loop.

n=int(input(“enter the number”))


i=4
while(i<n):
print(i)
i=i+2

OUTPUT:
enter the number:10
4
6
8

*******************************************************************************

PROGRAM:14
WAP to print odd numbers from 3 to 10 using while loop.

n=int(input(“enter the number”))


i=3
while(i<n):
print(i)
i=i+2

OUTPUT:
enter the number:10

3
5
7
9

********************************************************************************
PROGRAM:15

WAP to create the list of n elements and elements are entered by user.

l=[]
n=int(input(“enter the number of elements”))
For I in range(n):
ele=int(input(“enter the element”))
l.append(ele)
print(l)

OUTPUT:
enter the number of elements 3
enter the element 7
enter the element 9
enter the element 12
[7,9,12]
********************************************************************************

PROGRAM:16
WAP to insert the new element at end of the list.

l=[6,18,22,19]
ele=int(input(“enter the element”))
l.append(ele)
print(l)

OUTPUT:
enter the element 45
[6,18,22,19,45]

PROGRAM:17
WAP to find the mean of the list,

l=[23,34,89,56]

n=sum(l)/len(l)

print(“Mean of list is”,n)

OUTPUT
Mean of list is:50.5
PROGRAM:18
WAP to insert the new list at the end of list.

l=[6,18,22,19]
l2=[67,87]
l.extend(l2)
print(l)

OUTPUT:
[6,18,22,19,67,87]

********************************************************************************

PROGRAM:19
WAP to print the total number of items present in the list.

l=[43,50,54,78, 54,78]

p=len(l)

print(“No of elements in list”,p)

OUTPUT

No of elements in list:6

********************************************************************************

PROGRAM:20

WAP to find the largest element of the list.

l=[90,50,54,8, 54,98]

p=max(l)

print(“Largest element in list:”,p)

OUTPUT

Largest element in list :98

********************************************************************************

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