0% found this document useful (0 votes)
27 views4 pages

Practical - IX - AI

practical class 12
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)
27 views4 pages

Practical - IX - AI

practical class 12
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/ 4

PM SHRI KENDRIYA VIDYALAYA

SABARMATI

Artificial Intelligence

Name: -
Class: -
Roll no:-

UNDER THE GUIDANCE OF : MS. RASHMIKA


(COMPUTER INSTRUCTOR)
Page 1
PM SHRI KENDRIYA VIDYALAYA
SABARMATI

DEPARTMENT OF ARTIFICIAL INTELLIGENCE

CERTIFICATE
This is to certify that Maste/Kumari. _____________a student
of class ______ ,School Roll no:______ has successfully
completed the Practical file for INTERNAL EXAMINATION
under the guidance of Ms.Rashmika,(Computer Instructor)
during the year 2023-2024.

Date :- …………………………
Subject Teacher’s Signature :- ………………………..

Page 2
PRACTICAL NO: 1
OBJECTIVE Write a program to input two numbers and swap them.
SOURCE Num1=int(input("Enter Number-1: "))
CODE: Num2=int(input("Enter Number-2: "))
print("Before Swap: ")
print("Num1: ", Num1)
print("Num2: ", Num2)

Num1, Num2= Num2, Num1


print("After Swap:")
print("Num1: ", Num1)
print("Num2: ", Num2)

OUTPUT: Enter Number-1: 10


Enter Number-2: 20
Before Swap:
Num1: 10
Num2: 20
After Swap:
Num1: 20
Num2: 10

PRACTICAL NO: 2
OBJECTIVE Write a program to input three numbers and swap them as this: 1 st number becomes 2nd
number 2nd number becomes 3rd number and 3rd number becomes 1st number.
SOURCE Num1=int(input("Enter Number-1: "))
CODE: Num2=int(input("Enter Number-2: "))
Num3=int(input("Enter Number-3: "))
print("Before Swap: ")
print("Num1: ", Num1)
print("Num2: ", Num2)
print("Num3: ", Num3)

Num1, Num2,Num3= Num2, Num3,Num1


print("After Swap:")
print("Num1: ", Num1)
print("Num2: ", Num2)
print("Num3: ", Num3)

OUTPUT: Enter Number-1: 10


Enter Number-2: 20
Enter Number-3: 30
Before Swap:
Num1: 10
Num2: 20
Num3: 30
After Swap:
Num1: 20
Num2: 30
Num3: 10

Page 3
PRACTICAL NO: 3

OBJECTIVE Write a program that reads two numbers and an arithmetic operator and displays the
computed result.
SOURCE a=float(input('Enter the first number: '))
CODE: b=float(input('Enter the second number: '))
c=input('Enter the operator[/,*,+,-]: ')
if c=='/':
r=a/b
print(a,c,b,'=',r)
elif c=='*':
r=a*b
print(a,c,b,'=',r)
elif c=='+':
r=a+b
print(a,c,b,'=',r)
elif c=='-':
r=a-b
print(a,c,b,'=',r)
else:
print('Invalid operator')

OUTPUT: Enter the first number: 8


Enter the second number: 2
Enter the operator[/,*,+,-]: /
8.0 / 2.0 = 4.0

PRACTICAL NO: 4
OBJECTIVE Write a program to accept the year and check if it is a leap year or not.
SOURCE a=int(input('Enter the year:'))
CODE: if a%4==0:
print('This year is a leap year')
else:
print('This year is not a leap year')

OUTPUT: Enter the year: 2020


This year is a leap year

PRACTICAL NO: 5
OBJECTIVE Write a program to find largest among three integers. Make use of if -else statement.
SOURCE a=int(input('Enter the first integer:'))
CODE: b=int(input('Enter the second integer:'))
c=int(input('Enter the third integer:'))
if a>b and a>c:
print(a, 'is the largest integer')
if b>a and b>c:
print(b, 'is the largest integer')
if c>a and c>b:
print(c, 'is the largest integer')
else:
print(‘All or any two are equal')
OUTPUT: Enter the first integer:56
Enter the second integer:34
Enter the third integer:67
67 is the largest integer.

Page 4

You might also like