0% found this document useful (0 votes)
38 views26 pages

Artificial Intelligence

The document is a practical file for an Artificial Intelligence project completed by Chhavi Anand, a student of class 9-F. It includes a certificate of completion, acknowledgments, and an index of 20 Python programming tasks related to various topics such as calculations, conditionals, and loops. Each task is accompanied by source code and expected output.

Uploaded by

chhavibarnawal
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)
38 views26 pages

Artificial Intelligence

The document is a practical file for an Artificial Intelligence project completed by Chhavi Anand, a student of class 9-F. It includes a certificate of completion, acknowledgments, and an index of 20 Python programming tasks related to various topics such as calculations, conditionals, and loops. Each task is accompanied by source code and expected output.

Uploaded by

chhavibarnawal
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/ 26

ARTIFICIAL INTELLIGENCE

PRACTICAL FILE

Name: Chhavi

Anand Class: 9-F

Roll no: 06

Submitted To: Shivani Singhal


CERTIFICATE

This is to certify that Chhavi Anand of class _IXF_, Roll No _6_ has completed AI Report File under my
supervision and guidance as per the latest curriculum of Central Board of Secondary Education (2023-2024).

Teacher In-charge

Date: 24.09.23
ACKNOWLEDGEMENT

In the accomplishment of this practical file successfully, many people have best owned upon me their blessings

and the heart pledged support, this time I am utilizing to thank all the people who have been concerned with this

practical file. Primarily I would thank God for being able to complete this project with success. Then I would

like to thank my Principal Mr. Gaurav Bedi and Artificial Intelligence teacher Ms. Shivani Singhal whose

valuable guidance has been the ones that helped me prepare this file and make it a success. Their suggestions

and instructions have served as the major contributor towards the completion of the file. Then I would like to

thank my parents and friends who have helped me with their valuable suggestions and guidance has been very

helpful in various phases. Last but not the least I would like to thank my classmates who have helped me a lot.

Name: Chhavi Anand

Roll no: 06
INDEX

S.NO TOPIC

1 Write a python program to input dimensions of a circle from the user and calculate
the area.

2 Write a program to print the multiplication table of the number given by the user.

3 Write a Python program to convert days into years, weeks and months.

4 Write a program to print the value of x, where


x = 3 + 32 +33 +34

5 Write a python program to find whether a person is eligible to be categorised as a


senior citizen or not, depending on the input age.

6 Write a program to enter 3 angles and find whether it's a valid triangle or not.

7 Write a program to find whether a number is divisible by 5 and 11.

8 Write a program to input electricity unit charges and calculate total electricity bill
according to the given condition:
● For first 50 units Rs. 0.50/unit
● For next 100 units Rs. 0.75/unit
● For next 100 units Rs. 1.20/unit
● For unit above 250 Rs. 1.50/unit

9 Write a program to input marks of five subjects Physics, Chemistry, Biology,


Mathematics and Computer. Calculate percentage and grade according to
following:
● Percentage >= 90% : Grade A
● Percentage >= 80% : Grade B
● Percentage >= 70% : Grade C
● Percentage >= 60% : Grade D
● Percentage >= 40% : Grade E
● Percentage < 40% : Grade F
10 Write a program to find the season based on the month entered. [March - June =
Summer, July-October = Rainy, November - February = Winter]

11 Write a program to find whether a year is a leap year or not.

12 Write a program to calculate profit or the loss based on the Cost price and
Selling price entered by the user.
13 Write a program to check whether the triangle is equilateral, scalene or isosceles.

14 Write a program to print a multiplication table of the number entered by the user
using the while loop
15 Write a program to count total digits in a number.

16 Write a program to print the following pattern


*
**
***
****
*****
17 Write a program to print list in reverse order using a loop.

18 Write a program reverse a given integer number using for loop

19 Write a program find the sum of the series upto n terms using for loop

20 Write a program to enter the numbers till the user wants and print the sum of
all the numbers at the end of the program using for loop
Program 1: To input dimensions of a circle from the user and calculate the area.

Source Code :-

radius= int(input("Enter the radius of a circle"


)) area= 3.14*radius**2
print(area)

Output :-
Program 2: Write a program to print the multiplication table of the number given by the user.

number = int(input("Enter a number: "))


print("Multiplication Table of number:")

for i in range(1, 11):


print(number ,"x", i , "=",number * i)

Output :-
Program 3: Write a Python program to convert days into years, weeks and months.

Source Code :-

print("Enter the Number of Days: ")


num = int(input())

year = int(num/365)
week = int(num/7)
months = int(num/30)

print("Total Number of Year(s):


") print(year)
print("Total Number of
Week(s):") print(week)
print("Total Number of
Month(s):") print(months)

Output :-
Program 4: Write a program to print the value of x,
where x = 3 + 32 +33 +34

Source Code :-

x= 3+3**2+3**3+3**4
print(x)

Output :-
Program 5: Write a python program to find whether a person is eligible to be categorised as a senior
citizen or not, depending on the input age.

Source Code :-

age = int(input("Enter age:"))


if age>=60:
print ("Eligible to be a senior citizen")
else:
print ("not eligible")

Output :-
Program 6: Write a program to enter 3 angles and find whether it's a valid triangle or not

Source Code :-

angle1 = int(input("Enter the first angle: "))


angle2 = int(input("Enter the second angle: "))
angle3 = int(input("Enter the third angle: "))
if angle1 + angle2 + angle3 == 180:
print("Valid triangle.")
else:
print("Not a valid triangle.")

Output :-
Program 7: Write a program to find whether a number is divisible by 5 and 11.

Source Code :-

num = int(input("Enter a number: "))


if num % 5 == 0 and num % 11 == 0:
print("Is divisible by 5 and 11.")
else:
print("Is not divisible by both 5 and 11.")

Output :-
Program 8: Write a program to input electricity unit charges and calculate total electricity bill according to
the given condition:
● For first 50 units Rs. 0.50/unit
● For next 100 units Rs. 0.75/unit
● For next 100 units Rs. 1.20/unit
● For unit above 250 Rs. 1.50/unit

Source Code :-

units = int(input("Enter the number of electricity units consumed: "))

if units <= 50:


total_bill = units * 0.50
elif units <= 150:
total_bill = 50 * 0.50 + (units - 50) * 0.75
elif units <= 250:
total_bill = 50 * 0.50 + 100 * 0.75 + (units - 150) * 1.20
else:
total_bill = 50 * 0.50 + 100 * 0.75 + 100 * 1.20 + (units - 250) * 1.50

print("Total electricity bill: Rs.", total_bill)

Output :-
Program 9: Write a program to input marks of five subjects Physics, Chemistry, Biology, Mathematics and
Computer. Calculate percentage and grade according to following:
● Percentage >= 90% : Grade A
● Percentage >= 80% : Grade B
● Percentage >= 70% : Grade C
● Percentage >= 60% : Grade D
● Percentage >= 40% : Grade E
● Percentage < 40% : Grade F

Source Code :-
physics = int(input("Enter Physics marks"))
chemistry = int(input("Enter Chemistry marks")
biology = int(input("Enter Biology marks"))
mathematics = int(input("Enter Mathematics marks"))
computer = int(input("Enter Computer marks"))
total_marks = physics + chemistry + biology + mathematics +
computer percentage = (total_marks / 500) * 100
if percentage >= 90:
grade = "Grade A"
elif percentage >= 80:
grade = "Grade B"
elif percentage >= 70:
grade = "Grade C"
elif percentage >= 60:
grade = "Grade D"
elif percentage >= 40:
grade = "Grade E"
else:
grade = "Grade F"
print("Percentage:", percentage,
"%") print("Grade:", grade)

Output :-
Program 10: Write a program to find the season based on the month entered. [March - June = Summer,
July-October = Rainy, November - February = Winter]

Source Code :-

month = input("Enter a month: ")

summer_months = ["march", "april", "may", "june"]


rainy_months = ["july", "august", "september", "october"]
winter_months = ["november", "december", "january", "february"]

if month in summer_months:
season = "Summer"
elif month in rainy_months:
season = "Rainy"
elif month in winter_months:
season = "Winter"
else:
season = "Invalid month"

print("The season for this month is", season )

Output :-
Program 11: Write a program to find whether a year is a leap year or not.

Source Code :-

year = int(input("Enter a year:


")) if year % 4 == 0:
if year % 100 == 0:
if year % 400 == 0:
print(f"{year} is a leap
year.")
else:
print(f"{year} is not a leap year.")
else:
print(f"{year} is a leap year.")
else:
print(f"{year} is not a leap year.")

Output :-
Program 12: Write a program to calculate profit or the loss based on the Cost price and Selling price
entered by the user.

Source Code :-
cp=int(input("Enter the cost Price of an Item :"))
sp=int(input("Enter the Selling Price of an Item :"))
if (sp > cp):
print("Profit :",sp -
cp) elif( cp > sp):
print("Loss :",cp - sp)
else:
print("No Profit No Loss")

Output :-
Program 13: Write a program to check whether the triangle is equilateral, scalene or isosceles.

Source Code :-
a = float(input("Enter length of side 1: "))
b = float(input("Enter length of side 2: "))
c = float(input("Enter length of side 3: "))

if a == b == c:
print("Triangle is Equilateral")
elif a == b or b == c or a == c:
print("Triangle is Isosceles")
else:
print("Triangle is Scalene")

Output :-
Program 14: Write a program to print a multiplication table of the number entered by the user using the
while loop

Source Code :-
n = int(input("Enter any Number :"));
i=1
while i <= 10:
value = n * i
print(value)
i=i+1

Output :-
Program 15: Write a program to count total digits in a number.

Source Code :-
num = int(input("Enter any Number :"));
count = 0

while num != 0:
num //= 10
count += 1

print("Number of digits: " + str(count))

Output :-
Program 16: Write a program to print the following pattern
*
**
***
****
*****

Source Code :-
rows = 5
print("Pattern:")
for i in range(1, rows +
1): print("*" * i)

Output :-
Program 17: Write a program to print list in reverse order using a loop.

Source Code :-
my_list = [1, 2, 3, 4, 5]

print("Original list:", my_list)


print("List in reverse order:")
for item in reversed(my_list):
print(item)

Output :-

Program 18: Write a program reverse a given integer number using for loop

Source Code :-
number = int(input("Enter an integer: "))

number_str = str(number)
reversed_num = ""

for digit in
reversed(number_str):
reversed_num += digit

reversed_number = int(reversed_num)

print(f"Reversed number:

{reversed_number}")

Output :-

Program 19: Write a program find the sum of the series upto n terms using for loop
Source Code :-
n = int(input("Enter the number of terms: "))
sum = 0
for i in range(1, n +
1): sum = sum+i

print("Sum of the series:", sum)

Output :-

Program 20: Write a program to enter the numbers till the user wants and print the sum of all the numbers
at the end of the program using for loop

Source Code :-
sum_of_numbers = 0
while True:
num = float(input("Enter a number (enter 0 to stop): "))
if num == 0:
break
sum_of_numbers += num

print("Sum of all the numbers entered:", sum_of_numbers)


Output

You might also like