0% found this document useful (0 votes)
6 views18 pages

Ai Project File-Python Programs

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)
6 views18 pages

Ai Project File-Python Programs

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/ 18

‭AI PROJECT FILE- PYTHON PROGRAMS‬

‭PROGRAM-1‬
‭ADDITION OF 2 NUMBERS‬

‭INPUT-‬

‭x=int(input("Enter the first number- "))‬


‭y=int(input("Enter the second number- "))‬
‭z=x+y‬
‭print("The sum of the given numbers is", z)‬

‭OUTPUT-‬
‭PROGRAM-2‬
‭SUBTRACTION OF 2 NUMBERS‬

‭INPUT-‬

‭x=int(input("Enter the first number- "))‬


‭y=int(input("Enter the second number- "))‬
‭z=x-y‬
‭print("The difference of the given numbers is", z)‬

‭OUTPUT-‬
‭PROGRAM-3‬
‭PRODUCT OF 2 NUMBERS‬

‭INPUT-‬

‭x=int(input("Enter the first number- "))‬


‭y=int(input("Enter the second number- "))‬
‭z=x*y‬
‭print("The product of the given numbers is", z)‬

‭OUTPUT-‬
‭PROGRAM – 4‬
‭QUOTIENT‬

‭INPUT-‬

‭x=int(input("Enter the first number- "))‬


‭y=int(input("Enter the second number- "))‬
‭z=x/y‬
‭print("The quotient of the given numbers is", z)‬

‭OUTPUT-‬
‭PROGRAM – 5‬
‭FINDING REMAINDER‬

‭INPUT-‬

‭x=int(input("Enter the first number- "))‬


‭y=int(input("Enter the second number- "))‬
‭z=x%y‬
‭print("The remainder is", z)‬

‭OUTPUT-‬
‭PROGRAM – 6‬
‭FINDING THE GREATER OF THE 2 NUMBERS‬

‭INPUT-‬

‭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‬
‭ELIGIBILITY TO VOTE‬

‭INPUT-‬

‭age=int(input("Enter your age- "))‬


‭if age>=18:‬
‭print("You are eligible to vote")‬
‭else:‬
‭print("Sorry, you are not eligible to vote this time")‬

‭OUTPUT-‬

‭OR‬
‭PROGRAM – 8‬
‭ODD OR EVEN NUMBER‬

‭INPUT-‬

‭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-‬

‭OR‬
‭Program – 9‬
‭Area of Rectangle‬
‭l = int(input("Enter the length of the rectangle:- "))‬
‭b = int(input("Enter the breadth of the rectangle:- "))‬
‭area = l*b‬
‭print("The area of the given rectangle is", area)‬

‭Output‬
‭Program – 10‬
‭Area of Square‬
‭s = int(input("Enter the length of the side of the square:- "))‬
‭area = s*s‬
‭print("The area of the square is", area)‬

‭Output‬
‭Program – 11‬
‭Area of Triangle‬
‭h = int(input("Enter the height of the triangle:- "))‬
‭b = int(input("Enter the base of the triangle:- "))‬
‭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:- "))‬
‭area = 3.14*r*r‬
‭print("The area of the circle is", area)‬

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

‭Output‬
‭Program – 14‬
‭Creating a List‬
‭cricketers=["Virat", "Dhoni", "Rohit", "Bumrah", "Siraj", "Jaiswal"]‬
‭print("The names of the cricketers are:- \n")‬
‭print(cricketers)‬

‭Output‬
‭Program – 15‬
‭Creating a Tuple‬
‭footballers=("Ronaldo", "Messi", "Neymar", "Mbappe", "Pele")‬
‭print("\n The names of the footballers are :- \n")‬
‭print(footballers)‬

‭Output‬
‭Program – 16‬
‭Creating a Dictionary‬
c‭ aptains={"RCB":"Virat", "CSK":"Dhoni", "MI":"Rohit", "DC":"Kl Rahul",‬
‭"LSG":"Pant"}‬
‭print("\n The IPL teams and their captains are :- \n")‬
‭print(captains)‬

‭Output‬

You might also like