Practical - IX - AI
Practical - IX - AI
SABARMATI
Artificial Intelligence
Name: -
Class: -
Roll no:-
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)
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)
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')
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')
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