PM SHRI KENDRIYA VIDYALAYA GOLE
MARKET, NEW DELHI (SHIFT-1)
PRACTICAL FILE
OF
ARTIFICIAL INTELLIGENCE (417)
CLASS: X
SESSION: 2025-26
SUBMITTED BY:-
Student Name:-
Class & Sec: - X &
Roll No:
CERTIFICATE
This is to certify that __________________________, has successfully
completed the Class X Artificial Intelligence Practical Course for the
academic session 2025-2026.
He/She has demonstrated satisfactory performance in all practical
exercises, including Python programming, AI concepts, and practical
work. This certificate is issued for record and academic purposes.
Name of the Teacher: Gaurav Sharma
Name of the Principal: Shuchita kaushal
Q1. Write a Python program to print “Hello, World!”
Code:
print("Hello, World!")
Output:
Hello, World!
Q2. Write a Python program to add two numbers (input from user).
Code:
a = int(input("Enter first number: "))
b = int(input("Enter second number: "))
sum = a + b
print("Sum of two numbers is:", sum)
Output :
Enter first number: 10
Enter second number: 20
Sum of two numbers is: 30
Q3. Write a Python program to check whether a number is even or
odd.
Code:
num = int(input("Enter a number: "))
if num % 2 == 0:
print("The number is Even")
else:
print("The number is Odd")
Output:
Enter a number: 7
The number is Odd
Q4. Write a Python program to find the largest of three numbers.
Code:
a = int(input("Enter first number: "))
b = int(input("Enter second number: "))
c = int(input("Enter third number: "))
if a >= b and a >= c:
print("Largest number is:", a)
elif b >= a and b >= c:
print("Largest number is:", b)
else:
print("Largest number is:", c)
Output:
Enter first number: 15
Enter second number: 25
Enter third number: 20
Largest number is: 25
Q5. Write a Python program to find the factorial of a number.
Code:
num = int(input("Enter a number: "))
fact = 1
for i in range(1, num + 1):
fact *= i
print("Factorial of", num, "is:", fact)
Output:
Enter a number: 5
Factorial of 5 is: 120
Q6. Write a Python program to check whether a number is prime or
not.
Code:
num = int(input("Enter a number: "))
count = 0
for i in range(1, num + 1):
if num % i == 0:
count += 1
if count == 2:
print("Prime number")
else:
print("Not a prime number")
Output:
Enter a number: 7
Prime number
Q7. Write a Python program to print Fibonacci series.
Code:
n = int(input("Enter the number of terms: "))
a, b = 0, 1
print(a, b, end=" ")
for i in range(2, n):
c=a+b
print(c, end=" ")
a, b = b, c
Output:
Enter the number of terms: 7
0112358
Q8. Write a Python program to find the sum of digits of a number.
Code:
num = int(input("Enter a number: "))
sum = 0
while num > 0:
digit = num % 10
sum += digit
num //= 10
print("Sum of digits:", sum)
Output:
Enter a number: 1234
Sum of digits: 10
Q9. Write a Python program to reverse a number.
Code:
num = int(input("Enter a number: "))
rev = 0
while num > 0:
digit = num % 10
rev = rev * 10 + digit
num //= 10
print("Reversed number:", rev)
Output:
Enter a number: 1234
Reversed number: 4321
Q10. Write a Python program to check if a number is palindrome or
not.
Code:
num = int(input("Enter a number: "))
temp = num
rev = 0
while num > 0:
digit = num % 10
rev = rev * 10 + digit
num //= 10
if temp == rev:
print("Palindrome number")
else:
print("Not a palindrome number")
Output:
Enter a number: 121
Palindrome number
Q11. Write a Python program to find the square of a number using a
function.
Code:
def square(n):
return n * n
num = int(input("Enter a number: "))
print("Square of", num, "is:", square(num))
Output:
Enter a number: 6
Square of 6 is: 36
Q12. Write a Python program to calculate the area of a circle.
Code:
r = float(input("Enter radius of the circle: "))
area = 3.14 * r * r
print("Area of the circle is:", area)
Output:
Enter radius of the circle: 5
Area of the circle is: 78.5
Q13. Write a Python program to count vowels in a string.
Code:
text = input("Enter a string: ")
vowels = "aeiouAEIOU"
count = 0
for ch in text:
if ch in vowels:
count += 1
print("Number of vowels:", count)
Output:
Enter a string: Artificial Intelligence
Number of vowels: 10
Q14. Write a Python program to check whether a number is
Armstrong or not.
Code:
num = int(input("Enter a number: "))
sum = 0
temp = num
while temp > 0:
digit = temp % 10
sum += digit ** 3
temp //= 10
if num == sum:
print("Armstrong number")
else:
print("Not an Armstrong number")
Output:
Enter a number: 153
Armstrong number
Q15. Write a Python program to display multiplication table of a
number.
Code:
num = int(input("Enter a number: "))
for i in range(1, 11):
print(num, "x", i, "=", num * i)
Output:
Enter a number: 5
5x1=5
5 x 2 = 10
5 x 3 = 15
5 x 4 = 20
5 x 5 = 25
5 x 6 = 30
5 x 7 = 35
5 x 8 = 40
5 x 9 = 45
5 x 10 = 50
Q16. Write a Python program to find the smallest number in a list.
Code:
numbers = list(map(int, input("Enter numbers separated by space:
").split()))
print("Smallest number is:", min(numbers))
Output:
Enter numbers separated by space: 12 45 7 89 23
Smallest number is: 7
Q17. Write a Python program to find the sum of all elements in a list.
Code:
numbers = list(map(int, input("Enter numbers separated by space:
").split()))
print("Sum of list elements:", sum(numbers))
Output:
Enter numbers separated by space: 2 4 6 8 10
Sum of list elements: 30
Q18. Write a Python program to sort a list in ascending order.
Code:
numbers = list(map(int, input("Enter numbers separated by space:
").split()))
[Link]()
print("Sorted list:", numbers)
Output:
Enter numbers separated by space: 9 3 5 1 7
Sorted list: [1, 3, 5, 7, 9]
Q19. Write a Python program to count even numbers in a list.
Code:
numbers = list(map(int, input("Enter numbers separated by space:
").split()))
count = 0
for i in numbers:
if i % 2 == 0:
count += 1
print("Total even numbers:", count)
Output:
Enter numbers separated by space: 2 5 8 11 14 17
Total even numbers: 3
Q20. Write a Python program to display current date and time.
Code:
import datetime
now = [Link]()
print("Current date and time:", now)
Output:
Current date and time: 2025-09-28 17:30:45.345678