Grade 10 AI - Project File
Grade 10 AI - Project File
Topic
1 Python program that takes two numbers as input and calculates both
their Highest Common Factor (HCF) and Least Common Multiple (LCM).
4 Python program to find all numbers between 1000 and 2000 that are
divisible by 7 and are multiples of 5.
8 Python program that generates a scatter chart for the following points
(2,5), (9,10),(4,8), (6,18).
13 Python program that collects temperature readings for all seven days of
the week and calculates the average temperature for the week.
Page 1 of 13
Program 1
Write a Python program that takes two numbers as input and calculates both their Highest Common
Factor (HCF) and Least Common Multiple (LCM).
a, b = num1, num2
while b != 0:
a, b = b, a % b
hcf = a
print("HCF:", hcf)
print("LCM:", lcm)
Output
Page 2 of 13
Program 2
Write a Python program to find the sum of the first 10 natural numbers.
sum = 0
sum += i
Output
Program 3
Write a Python program to create a list of student names and arrange them in alphabetical order.
students.sort()
print(students)
Output
Page 3 of 13
Program 4
Write a Python program to find all numbers between 1000 and 2000 that are divisible by 7 and are
multiples of 5.
print(number)
Output
1015
1050
1085
1120
1155
1190
1225
1260
1295
1330
1365
1400
1435
1470
1505
1540
1575
1610
1645
1680
1715
1750
1785
1820
1855
1890
1925
1960
1995
Page 4 of 13
Program 5
Write a Python program to input an employee's name, age, and basic salary. Calculate the
employee's total salary by adding 10% Dearness Allowance (DA) and 10% House Rent Allowance
(HRA) to the basic salary.
# Calculate allowances
Output
Page 5 of 13
Program 6
Write a Python program that calculates the mean, median, and mode of a list of numbers.
numbers = [1, 2, 2, 3, 4, 4, 4, 5, 6]
# Calculate mean
print("Mean:", mean)
# Calculate median
sorted_numbers = sorted(numbers)
n = len(sorted_numbers)
if n % 2 == 0:
else:
median = sorted_numbers[n // 2]
print("Median:", median)
# Calculate mode
max_count = 0
mode = None
for i in numbers:
count = 0
for j in numbers:
if i == j:
count += 1
max_count = count
mode = i
print("Mode:", mode)
Output
Mean: 3.4444444444444446
Median: 4
Mode: 4
Page 6 of 13
Program 7
Write a Python program that generates a line chart representing a straight line between the points
(2, 5) and (9, 10).
# Points to plot
x = [2, 9]
y = [5, 10]
plt.plot(x, y)
plt.xlabel('X-axis')
plt.ylabel('Y-axis')
plt.grid()
plt.show()
Output
Page 7 of 13
Program 8
Write a Python program that generates a scatter chart for the following points (2,5), (9,10)(4,8),
(6,18).
x = [2, 9, 4, 6] # x-coordinates
plt.xlabel('X-axis')
plt.ylabel('Y-axis')
# Show grid
plt.grid()
plt.show()
Output
Page 8 of 13
Program 9
Write a Python program to read an image file and display it on the screen.
img = mpimg.imread('path/to/your/image.jpg')
plt.imshow(img)
plt.show()
Output
Image display
Program 10
Create a Python program that takes height as input in centimeters and converts it to inches and feet.
# Conversion factors
Output
num_str = str(num)
num_digits = len(num_str)
# Calculate the sum of the digits raised to the power of the number of digits
if sum_of_powers == num:
else:
Output
Page 10 of 13
Program 12
11111
2222
333
44
rows = 5
Program 13
Create a Python program that collects temperature readings for all seven days of the week and
calculates the average temperature for the week.
total = 0
temp = input(f"Enter temperature for day {day}: ") # Get input as string
average_temp = total / 7
Output
Page 11 of 13
Enter temperature for day 1: 20
Enter temperature for day 2: 25
Enter temperature for day 3: 22
Enter temperature for day 4: 28
Enter temperature for day 5: 29
Enter temperature for day 6: 28
Enter temperature for day 7: 30
Average temperature for the week is: 26.0
Program 14
Write a Python program that checks whether a number entered by the user is a palindrome.
if number == number[::-1]:
print(f"{number} is a palindrome.")
else:
Output
Page 12 of 13
Program 15
Write a Python program that checks whether a number entered by the user is positive, negative, or
zero.
if number > 0:
print(f"{number} is positive.")
print(f"{number} is negative.")
else:
Output
Page 13 of 13