0% found this document useful (0 votes)
4 views2 pages

Important Python Programs For Pre Mid Term STD Ix Ai 417

The document provides important Python programs for an Artificial Intelligence pre-midterm exam, including calculations for the sum of three numbers, average of four numbers, difference of two numbers, area and perimeter of a rectangle, area and circumference of a circle, and quotient and remainder of two numbers. Each program is accompanied by example input and output. These programs serve as practical exercises for students to understand basic programming concepts in Python.

Uploaded by

Kakan Sarkar
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)
4 views2 pages

Important Python Programs For Pre Mid Term STD Ix Ai 417

The document provides important Python programs for an Artificial Intelligence pre-midterm exam, including calculations for the sum of three numbers, average of four numbers, difference of two numbers, area and perimeter of a rectangle, area and circumference of a circle, and quotient and remainder of two numbers. Each program is accompanied by example input and output. These programs serve as practical exercises for students to understand basic programming concepts in Python.

Uploaded by

Kakan Sarkar
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/ 2

IMPORTANT PYTHON PROGRAMS FOR PRE-MID TERM EXAM

SUB: ARTIFICIAL INTELLIGENCE (417)

#Sum of 3 numbers
a=int(input("Enter First Number: "))
b=int(input("Enter Second Number: "))
c=int(input("Enter Third Number: "))
s=a+b+c
print("Sum of 3 numbers: ",s)

OUTPUT:

Enter First Number: 45


Enter Second Number: 6
Enter Third Number: 71
Sum of 3 numbers: 122

#Average of 4 numbers
a=int(input("Enter First Number: "))
b=int(input("Enter Second Number: "))
c=int(input("Enter Third Number: "))
d=int(input("Enter Fourth Number: "))
avg=(a+b+c+d)/4
print("Average of 4 numbers: ",avg)

OUTPUT:
Enter First Number: 56
Enter Second Number: 78
Enter Third Number: 90
Enter Fourth Number: 21
Average of 4 numbers: 61.25

#Difference of 2 numbers
a=int(input("Enter First Number: "))
b=int(input("Enter Second Number: "))
diff=b-a
print("Difference of 2 numbers ",diff)

OUTPUT:
Enter First Number: 45
Enter Second Number: 67
Difference of 2 numbers 22
#Area and Perimeter of a rectangle
l=int(input("Enter Length: "))
b=int(input("Enter breadth: "))
ar=l*b
pr=2*(l+b)
print("Area of the rectangle: ",ar)
print("Perimeter of the rectangle: ",pr)

OUTPUT:
Enter Length: 12
Enter breadth: 9
Area of the rectangle: 108
Perimeter of the rectangle: 42

#Area and Circumference of a Circle


r=float(input("Enter radius of the circle: "))
ar=(22/7)*r*r
cir=2*(22/7)*r
print("Area of the circle: ",ar)
print("Circumference of the circle: ",cir)

OUTPUT:
Enter radius of the circle: 7
Area of the circle: 154.0
Circumference of the circle: 44.0

#Quotient and remainder of two numbers


p=int(input("Enter Divisor: "))
q=int(input("Enter Dividend: "))
q=q/p
rem=q%p
print("Quotient:",q)
print("Remainder: ",rem)

OUTPUT:
Enter Divisor: 6
Enter Dividend: 68
Quotient: 11.333333333333334
Remainder: 5.333333333333334

You might also like