0% found this document useful (0 votes)
12 views17 pages

AI Practicals

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
12 views17 pages

AI Practicals

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 17

PROGRAM - 1

Addition of 2 numbers
x=int(input("Enter the first number:- "))
y=int(input("Enter the second number:- "))
s=x+y
print("The sum of the given numbers is", s)

Output
PROGRAM – 2
Subtraction between 2 numbers
x=int(input("Enter the first number:- "))
y=int(input("Enter the second number:- "))
d=x-y
print("The difference of the given numbers is", d)

Output
PROGRAM – 3
Product of 2 numbers
x=int(input("Enter the first number:- "))
y=int(input("Enter the second number:- "))
p=x*y
print("The product of the given numbers is", p)

Output
PROGRAM – 4
Finding Quotient
x=int(input("Enter the first number:- "))
y=int(input("Enter the second number:- "))
q=x/y
print("The quotient of the given numbers is", q)

Output

PROGRAM – 5
Finding Remainder
x=int(input("Enter the first number:- "))
y=int(input("Enter the second number:- "))
r=x%y
print("The remainder is", r)

Output

PROGRAM – 6
Finding the Greatest Number of 2
numbers
x=int(input("Enter the first number:- "))
y=int(input("Enter the second number:- "))
if x>y:
print(x, "is greater than", y)
else:
print(y, "is greater than", x)

Output

PROGRAM – 7
Finding Eligibility to Vote
age=int(input("Enter your age:- "))
if age>=18:
print("You are eligible to vote")
else:
print("You are NOT eligible to vote")

Output

PROGRAM – 8
Finding Odd or Even Number
x=int(input("Enter the number:- "))
if x%2==0:
print("The given number is an EVEN number")
else:
print("The given number is an ODD number")

Output

PROGRAM – 9
Area of Rectangle
l = int(input("Enter the length of the rectangle(in cm):- "))
b = int(input("Enter the breadth of the rectangle(in cm):- "))
area = l*b
print("The area of the given rectangle is", area ,"cm²")

Output

PROGRAM – 10
Area of Square
s = int(input("Enter the length of the side of the square(in cm):-
"))
area = s*s
print("The area of the square is", area , "cm²")

Output

PROGRAM – 11
Area of Triangle
h = int(input("Enter the height of the triangle(in cm):- "))
b = int(input("Enter the base of the triangle(in cm):- "))
area = 0.5*h*b
print("The area of the given triangle is", area )

Output

PROGRAM – 12
Area of Circle
r = float(input("Enter the radius of the circle(in cm):- "))
area = 3.14*r*r
print("The area of the circle is", area, "cm²")

Output

PROGRAM – 13
Finding Simple Interest
p = int(input("Enter the Principal amount(in rupees):- "))
t = int(input("Enter the Time period (in years):- "))
r = float(input("Enter the Rate of interest (in %):- "))
SI = (p*r*t)/100
print("The Simple Interest is: ₹",SI)

Output

PROGRAM – 14
Creating a List
sports=["Basketball", "Cricket", "Football", "Volleyball", "Chess",
"Hockey"]
print("The names of the sports are:- ")
print(sports)

Output

PROGRAM – 15
Creating a Tuple
basketballplayers=("Steph Curry", "Lebron James", "Kobe Bryant",
"Victor Wembanyama", "Lamelo Ball")
print("The names of the basketball players are :- ")
print(basketballplayers)

Output

PROGRAM – 16
Creating a Dictionary
starplayers={"GSW":"Steph Curry", "SAS":"Victor Wembanyama",
"LAC":"Kawhi Leonard", "CHA":"Lamelo Ball", "BOS":"Jayson
Tatum"}
print("The NBA teams and their star players are :- ")
print(starplayers)

Output

You might also like