Nothing Special   »   [go: up one dir, main page]

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

A.I programs for project file

it contains various important python programs to help students for making their A.I project file

Uploaded by

abhideol09
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)
6 views11 pages

A.I programs for project file

it contains various important python programs to help students for making their A.I project file

Uploaded by

abhideol09
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/ 11

Program 1: Write a program to find whether an

inputted number is perfect or not.

Output:
Program 2: Program to enter two numbers and print the
arithmetic operations like +,-,*, /, // and %.

Output:
Program 3: Write a Program to check if the entered
number is Armstrong or not.:

Outpu
t:
Program 4: Write a Program to find factorial of
the entered number.

Output:
Program 5: Write a Program to enter the number
of terms and to print the Fibonacci Series.

Output:
Program 6: Write a Program to enter the string and to
check if it’s palindrome or not using loop.

Output:
Program 7: Recursively find the factorial of a
natural number.

Output:
Program 8: To calculate the area of a triangle.
Input:
#area of triangle

p = float(input('Enter the length of first side: '))


q = float(input('Enter the length of second side: '))
r = float(input('Enter the length of final side: '))

# calculate the semi-perimeter


s = (p + q + r)/2

# calculate the area


area_tri = (s*(s-p)(s-q)(s-r)) ** 0.5
print('The area of the triangle is %0.2f' %area_tri)

Output:
COPY CODE

Enter the length of the first side: 7


Enter the length of the second side: 5
Enter the length of the final side: 8
The area of the triangle is 17.32
Program 9: To find the square root of a number.
import math

print ("math.sqrt(100) : ", math.sqrt(100))

print ("math.sqrt(7) : ", math.sqrt(7))

print ("math.sqrt(math.pi) : ", math.sqrt(math.pi))

Output:

math.sqrt(100) : 10.0

math.sqrt(7) : 2.6457513110645907

math.sqrt(math.pi) : 1.7724538509055159
Program 10: To Add Matrices
INPUT:

X= [[8,6,3],

[4 ,5, 6],

[7 ,8, 3]]

Y = [[2,5,5],

[6,5,5],

[3,2,2]]
OUTPUT:
result= [[10,11,8],

[10,10,11],

[10,10,5]]

You might also like