0% found this document useful (0 votes)
17 views16 pages

Copy of Project Proposal

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)
17 views16 pages

Copy of Project Proposal

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

0

D.A.V FERTILIZER SCHOOL,BABRALA

ARTIFICIAL INTELLIGENCE PRACTICAL FILE

SUBMITTED BY: RAGHVENDRA BHARDWAJ

CLASS: IX BROWN

ROLL.NO: 31

SUBMITTED TO: MR.SURENDRA SINGH SIR

Practical
S.no

1. Print your personal information like Name, Father’s Name, Class and
School Name.

2. To print the following patterns using multiple print commands.


1

3. To print the square of number 7.

4. To print the sum of two numbers 15 and 20.

5. To convert length given in kilometers into meters.

6. To print the table of 5 up to five terms.

7. To calculate Simple Interest if the principal amount = 2000 rate of interest =


4.5 time = 10.

8. To calculate Area and Perimeter of a rectangle.

9. To calculate average marks of 3 subjects.

10. To calculate discounted amounts with discount % .

11. To calculate Surface Area and Volume of a Cuboid .

12. Create a list in Python of children selected for science quiz with following
names- Arjun, Sonakshi, Vikram, Sandhya, Sonal, Isha, Kartik .

13. Create a list num=[23,12,5,9,65,44].

14. Create a list of first 10 even numbers, add 1 to each list item and print the
final list

15. Create a list List_1=[10,20,30,40]. Add the elements [14,15,12] using the
2

extend function. Now sort the final list in ascending order and print it.

16. Write a python program to common characters in two strings?.

17. Write a python program to find the area of a triangle using herons
formula.

18. Thank-you.

1. Print your personal information like Name, Father’s Name, Class and School
Name?

Source Code:

#Code to print personal information

#using print function

print("My Name is: atul Kumar")

print("My Father's Name is: aman Kumar")

print("I am studying in Class IX")

print("School's Name is: D.A.V Fertilizer Public School")

Output:

My Name is: atul kumar

My Father's Name is: aman Kumar

I am studying in Class IX

school's Name is: D.A.V Fertilizer Public School

2. To print the following patterns using multiple print commands-

* *****
3

** ****

*** ***

**** **

***** *

Source Code:

print(‘* *****’)

print(‘** ****)

print(‘*** ***’)

Print(‘**** **’)

Print(‘***** *’)

Output:

* *****

** ****

*** ***

**** **

***** *

3. To print the square of number 7-

Source code:

#code to print the square of number

#Using print functions


4

num=7

square=num*num

print("The square of",num,"is:",square)

Output:

the square of 7 is: 49

4.To find the sum of two numbers 15 and 20?

Source code:

#code to print the sum two numbers 15 and 20

#using print functions

num1=15

num2=20

sum=num1+num2

print(“sum”)

Output:

35

5. To convert length given in kilometers into meters?

Source code:

#code to print length given in kilometer into meters

#using print functions

len_in_km=float(input("enter the length in kilometers?"))

con_factor=1000
5

len_in_m=len_in_km*con_factor

print(len_in_km,"kilometers is equal to",len_in_m,"meters.")

Output:

enter the length in kilometers?10

10.0 kilometers is equal to 10000.0 meters.

6. To print the table of 5 up to five terms?

Source code:

#code to print the table of 5 up to five terms.

#using print functions

print("the table of 5 is")

print("5*1 is 5")

print("5*2 is 10")

print("5*3 is 15")

print("5*4 is 20")

print("5*5 is 25")

Output:

the table of 5 is

5*1 is 5
6

5*2 is 10

5*3 is 15

5*4 is 20

5*5 is 25

7. To calculate Simple Interest if the principle_amount = 2000 rate_of_interest = 4.5


time = 10 ?

Source code:

#code to calculateSimple Interest if the principle_amount = 2000

rate of interest = 4.5 time = 10

#using print functions

p=2000

r=4.5/100

t=10

simple_interest=p*r*t

print("the simple_interest is:",simple_interest)

Output:

the simple_interest is: 900.0

8. To calculate the Area of a triangle with Base and Height?

Source code:

#code to calculate area of a triangle with base and height

# using input functions


7

base=float(input("enter the base of the triangle:"))

height=float(input("enter the height of the triangle:"))

area=1/2*base*height

print("the area of the triangle:",{area})

Output:

enter the base of the triangle:5

enter the height of the triangle:30

the area of the triangle: {75.0}

9. To calculate the area and perimeter of a rectangle?

Source code:

#code to calculate area and perimeter of a rectangle

# using input functions

length=float(input("enter the length of the rectangle:"))

width=float(input("enter the width of the rectangle:"))

area=length*width

print("the area of the rectangle is:",{area})

Output:

enter the length of the rectangle:1000

enter the width of the rectangle:729

the area of the rectangle is: {729000.0}

length=float(input("enter the length of the rectangle:"))


8

width=float(input("enter the width of the rectangle:"))

perimeter=2*(length+width)

print("the perimeter of the rectangle is:",{perimeter})

Output:

enter the length of the rectangle:69

enter the width of the rectangle:54

the perimeter of the rectangle is: {246.0}

10.To calculate average marks of 3 subjects?

Source code:

#code to calculating average marks of 3 subjects

# using input functions

subject1=float(input("enter the marks for subject1 :"))

subject2=float(input("enter the marks for subject2 :"))

subject3=float(input("enter the marks for subject3 :"))

average_marks=(subject+subject+subject 3)/3

print("the average marks of the three subjects is:",{average_marks})

Output:

enter the marks for subject 1 :80

enter the marks for subject2 :80

enter the marks for subject 3 :80

the average marks of the three subjects is: {80.0}


9

11. To calculate discounted amount with discount %

Source code:

#code to calculate discounted amount with discount %

# using input functions

original_amount=float(input("enter the original amount:"))

discount_percent=float(input("enter the discount percent:"))

discount_amount=discount_percent/100*original_amount

discount_amount=original_amount-discount_amount

print("the discount amount is:",{discount_amount})

Output:

enter the original amount:500

enter the discount percent:25

the discount amount:{375.0}

12.To calculate Surface Area and Volume of a Cuboid?

Source code:

#code to calculate surface area and volume of a cuboid

# using input functions

length=float(input("enter the length of the cuboid:"))

breadth=float(input("enter the breadth of the cuboid:"))

height=float(input("enter the height of the cuboid:"))


10

surface_area=2*(length*breadth+length*height+breadth*height)

print("the surface area of the cuboid is:",{surface_area})

Output:

enter the length of the cuboid:10

enter the breadth of the cuboid:5

enter the height of the cuboid:8

the surface area of the cuboid is: {340.0}

13.Create a list in Python of children selected for science quiz with following names- Arjun,
Sonakshi, Vikram, Sandhya, Sonal, Isha, Kartik? Perform the following tasks on the list in
sequence-

(a).Print the whole list

(b).Delete the name “Vikram” from the list

(c).Add the name “Jay” at the end

(d).Remove the item which is in the second position.

Source code:

#using list function

list1=['arjun','Sonakshi','Vikram','sandhya','Sonal','Isha','Kartik']

print(list1)

Output:

['arjun', 'Sonakshi', 'Vikram', 'sandhya', 'Sonal', 'Isha', 'Kartik']


11

list1=['arjun','Sonakshi','sandhya','Sonal','Isha','Kartik']

print(list1)

Output:

['arjun', 'Sonakshi', 'sandhya', 'Sonal', 'Isha', 'Kartik']

list1=['arjun','Sonakshi','sandhya','Sonal','Isha','Kartik','jay']

print(list1)

Output:

['arjun', 'Sonakshi', 'sandhya', 'Sonal', 'Isha', 'Kartik', 'jay']

list1=['arjun','sandhya','Sonal','Isha','Kartik','jay']

print(list1)

Output:
12

['arjun', 'sandhya', 'Sonal', 'Isha', 'Kartik', 'jay']

14. Write a python program to create list num= [23,12,5,9,65,44]?

Print the length of the list

Print the elements from second to fourth position using positive indexing

Print the elements from position third to fifth using negative indexing

Source code:

# using list function

num=[23,12,5,9,65,44]

len(num)

Output:

num=[23,12,5,9,65,44]

print(num[1:5])

Output:
13

[12, 5, 9, 65]

num=[23,12,5,9,65,44]

print(num[-4:-1])

Output:

[5, 9, 65]

15. Write a python program Create a list of first 10 even numbers, add 1 to each list item
and print the final list.

Source code:

# using list function

list1 = [2 * i for i in range(1, 11)]

list2 = [num + 1 for num in list1]

print(list2)

Output:

[3, 5, 7, 9, 11, 13, 15, 17, 19, 21]

16. Write a python program to common characters in two strings?

Source Code:

# Find common characters in two strings using a loop

string1 = input("Enter the first string? ")


14

string2 = input("Enter the second string? ")

common_characters = []

for char in string1:

if char in string and char not in common_characters:

common_characters.append(char)

print("The common characters between",string1,"and",string2,"are:",common_characters)

Output:

Enter the first string? hello

Enter the second string? world

The common characters between hello and world are: ['l', 'o']

17.python program to find the area of a triangle using herons formula.

Source code:

#s=(a+b+c)/2

#A=(s*(s-a)(s-b)(s-c))**0.5

a=int(input('enter side a:'))

b=int(input('enter side b:'))

c=int(input('enter side c:'))

s=(a+b+c)/2

A=(s*(s-a)(s-b)(s-c))**0.5
15

print("Area of triangle is: ", A)

Result:

enter,a=18

b=16

c=14

So Area=2351.5

You might also like