ARTIFICIAL INTELLIGENCE
(SUBJECT CODE 417)
CLASS – X (SESSION 2025-2026)
Total Marks: 100 (Theory-50 +
Practical-50)
2025/8/1 JYOTSNA VERMA 1
UNIT 3 – ADVANCE PYTHON
2025/8/1 JYOTSNA VERMA 2
PYTHON –
BASIC PROGRAMS USING OPERATORS
2025/8/1 JYOTSNA VERMA 3
Write a python program to calculate the area
and perimeter of a rectangle
2025/8/1 JYOTSNA VERMA 4
Write a python program to accept marks of any five
subjects and find the total and percentage
2025/8/1 JYOTSNA VERMA 5
WAP to swap two numbers :
a)Using third variable
b)Without using third variable
2025/8/1 JYOTSNA VERMA 6
>>> x=20
>>> y=10
>>> x,y=y,x
>>> x
10
>>> y
20
>>>
2025/8/1 JYOTSNA VERMA 7
PYTHON –
BASIC PROGRAMS USING IF STATEMENT
2025/8/1 JYOTSNA VERMA 8
2025/8/1 JYOTSNA VERMA 9
● Write a program to tell whether a person is eligible to drive or not.
● WAP to print the result of a student. The student is considered as passed if he has scored
more than 75 marks.
● WAP to check if a number is positive or negative
● Input a number from the user. Ask if they want to find the square of the number or double
it. Depending on the choice, perform the proper operations and print the final result.
● Ask the user to enter the length and breadth. Check whether it is a square or a rectangle.
2025/8/1 JYOTSNA VERMA 10
2025/8/1 JYOTSNA VERMA 11
2025/8/1 JYOTSNA VERMA 12
2025/8/1 JYOTSNA VERMA 13
WAP to check if a number is prime or not
2025/8/1 JYOTSNA VERMA 14
PYTHON –
NESTED IF STATEMENT
2025/8/1 JYOTSNA VERMA 15
● Write a program to calculate the smallest of three numbers
using IF-ELSE
2025/8/1 JYOTSNA VERMA 16
There are 4 subjects a student can choose from. Input the student
name and roll number and ask them their subject choice from maths,
computer, English and hindi. Print their details along with chosen
subject.
2025/8/1 JYOTSNA VERMA 17
● WAP to input basic salary of an employee and calculate its Gross
salary according to following
Basic Salary <= 10000 : HRA = 20%, DA = 80%
Basic Salary <= 20000 : HRA = 25%, DA = 90%
Basic Salary > 20000 : HRA = 30%, DA = 95%
2025/8/1 JYOTSNA VERMA 18
WAP to check whether a given number is one digit, two digit or three digits using nested if.
2025/8/1 JYOTSNA VERMA 19
PRACTISE QUESTIONS
WAP to calculate income tax as per the given condition:
Yearly income Tax rate
Upto Rs 2,50,000 Nil
Rs 2,50,001 to 3,00,000 5% of Yearly income
Rs 3,00,001 to 5,00,000 10% of Yearly income
Rs 5,00,001 to 10,00,000 20% of Yearly income
Above 10,00,000 30% of Yearly income
2025/8/1 JYOTSNA VERMA 20
AFTER SUMMER BREAK PROGRAMS
2025/8/1 JYOTSNA VERMA 21
WAP to create a mini calculator that works as a menu-based
program:
Press 1 to do addition
Press 2 to do subtraction
Press 3 to do division
Press 4 to to multiplication
Press 5 to exit
Depending upon the choice entered by the user, perform the
desired operation.
2025/8/1 JYOTSNA VERMA 22
WAP to calculate income tax as per the given condition:
Yearly income Tax rate
Upto Rs 2,50,000 Nil
Rs 2,50,001 to 3,00,000 5% of Yearly income
Rs 3,00,001 to 5,00,000 10% of Yearly income
Rs 5,00,001 to 10,00,000 20% of Yearly income
Above 10,00,000 30% of Yearly income
2025/8/1 JYOTSNA VERMA 23
WAP to check whether the entered number is palindrome or not.( A
palindrome is a number (or text) that reads the same forward and
backwards. Eg. 121,14241)
2025/8/1 JYOTSNA VERMA 24
2025/8/1 JYOTSNA VERMA 25
2025/8/1 JYOTSNA VERMA 26
WAP that accepts a number from the user and print it in
reverse order.
2025/8/1 JYOTSNA VERMA 27
2025/8/1 JYOTSNA VERMA 28
2025/8/1 JYOTSNA VERMA 29
Write a Python program to print the Fibonacci series between 0 and
50.
Note: The Fibonacci Sequence is the series of numbers :0, 1, 1, 2, 3,
5, 8, 13, 21, ....
2025/8/1 JYOTSNA VERMA 30
2025/8/1 JYOTSNA VERMA 31
PYTHON –
NESTED LOOP
2025/8/1 JYOTSNA VERMA 32
WAP to print the given pattern :
2025/8/1 JYOTSNA VERMA 33
WAP to print the given pattern :
2025/8/1 JYOTSNA VERMA 34
WAP to print the given pattern :
2025/8/1 JYOTSNA VERMA 35
WAP to print the given pattern :
2025/8/1 JYOTSNA VERMA 36
WAP to print the given pattern :
2025/8/1 JYOTSNA VERMA 37
WAP to print the given pattern :
2025/8/1 JYOTSNA VERMA 38
WAP to print the given pattern :
2025/8/1 JYOTSNA VERMA 39
● WAP to print the given pattern by accepting the number of
rows from user:
2025/8/1 JYOTSNA VERMA 40
WAP to print the number triangle" or a "number
pyramid
2025/8/1 JYOTSNA VERMA 41
PYTHON –
INTRODUCTION TO LIST
2025/8/1 JYOTSNA VERMA 42
CREATING A LIST
Dynamic
2025/8/1
list : D =list(eval(input(“Enter
JYOTSNA VERMA
Item using , (coma): ”))) 43
LIST TRAVERSAL
x=[12,132,342.23, ‘a’] x =[12,132,342.23, ‘a’]
for i in x: for i in range(len(x)):
print(i) print(x[i])
x =[12,132,342.23, ‘a’]
for i in range(len(x)):
print(i)
2025/8/1 JYOTSNA VERMA 45
Write a program to accept n marks from the user and store in a list
and then print it.
2025/8/1 JYOTSNA VERMA 46
2025/8/1 JYOTSNA VERMA 47
2025/8/1 JYOTSNA VERMA 48
WAP to accept 10 elements and store in list 1 and list 2. Now perform the following
task on it:
1. add the element of the list
2. subtract the element of the list
3. find the product of the element of the list
2025/8/1 JYOTSNA VERMA 49
2025/8/1 JYOTSNA VERMA 50
2025/8/1 JYOTSNA VERMA 51
Write a Program in Python to create a list of n numbers and
find the smallest and the largest List Elements.
2025/8/1 JYOTSNA VERMA 52
2025/8/1 JYOTSNA VERMA 53
2025/8/1 JYOTSNA VERMA 54
Write a program to input n elements from user and store them in a
list.
(a) Print the list in reverse order.
(b) Accept a number from the user and find if that number is
present in the list or not.
2025/8/1 JYOTSNA VERMA 55
2025/8/1 JYOTSNA VERMA 56
WAP to create the given list of:
● n vegetables
● N Vowels
● First n natural numbers
● Any n names of your friends
2025/8/1 JYOTSNA VERMA 57
2025/8/1 JYOTSNA VERMA 58
WAP to create the given list
month=[‘jan’, ‘feb’,’ ‘march’, ‘april’, ‘May’, ‘June’, ‘July’, ‘Aug’, ‘Sep’, ‘Oct’, ‘Nov’, ‘Dec’]
Now, write python code to print the following:
● Jan,feb,march
● July
● Aug
● Oct,Nov,Dec
● May
2025/8/1 JYOTSNA VERMA 59
# Creating the list of months
month = ['jan', 'feb', 'march', 'april', 'May', 'June', 'July', 'Aug', 'Sep', 'Oct',
'Nov', 'Dec']
# Printing the required outputs
print("Jan, feb, march:", month[0:3]) # First three months
print("July:", month[6]) # 7th month
print("Aug:", month[7]) # 8th month
print("Oct, Nov, Dec:", month[9:]) # Last three months
print("May:", month[4]) # 5th month
2025/8/1 JYOTSNA VERMA 60
Create a list in Python of your friend’s name in class X
Perform the following tasks on the list in sequence-
Print the whole list
Delete any one friend from the list
Add a new friend at the end
Remove the item which is at the second position.
2025/8/1 JYOTSNA VERMA 61
# Step 1: Create a list of friends' names
friends = ['Rahul', 'Aditi', 'Rohan', 'Sneha', 'Arjun']
# Step 2: Print the whole list
print("Original list of friends:", friends)
# Step 3: Delete any one friend from the list
friends.remove('Rohan') # Deleting 'Rohan'
print("After deleting 'Rohan':", friends)
# Step 4: Add a new friend at the end
friends.append('Ishika') # Adding 'Ishika'
print("After adding 'Ishika':", friends)
# Step 5: Remove the item at the second position
friends.pop(1) # Removing the second item
print("After removing the item at the second position:", friends)
2025/8/1 JYOTSNA VERMA 62
Create a list l1 of n elements and perform the given operations:
● 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
2025/8/1 JYOTSNA VERMA 63
# Step 1: Create a list with n elements
n = int(input("Enter the number of elements in the list: "))
l1 = []
for i in range(n):
element = input(f"Enter element {i+1}: ")
l1.append(element)
# Step 2: Print the length of the list
print("Length of the list:", len(l1))
# Step 3: Print elements from the second to the fourth position using positive indexing
print("Elements from second to fourth position (positive indexing):", l1[1:4])
# Step 4: Print elements from the third to the fifth position using negative indexing
if len(l1) >= 5:
print("Elements from third to fifth position (negative indexing):", l1[-len(l1)+2:-len(l1)+5])
else:
print("The list does not have enough elements for this operation.")
2025/8/1 JYOTSNA VERMA 64
Create a list l1 of n integers
● Add the elements [2,3,4] using the extend function.
● Now sort the final list in ascending order and print it.
2025/8/1 JYOTSNA VERMA 65
# Step 1: Create a list with n integers
n = int(input("Enter the number of elements in the list: "))
l1 = []
for i in range(n):
element = int(input(f"Enter integer {i+1}: "))
l1.append(element)
# Step 2: Add elements [2, 3, 4] using extend function
l1.extend([2, 3, 4])
print("List after adding [2, 3, 4]:", l1)
# Step 3: Sort the list in ascending order
l1.sort()
print("Sorted list in ascending order:", l1)
2025/8/1 JYOTSNA VERMA 66
CH - COMPUTER VISION
2025/8/1 JYOTSNA VERMA 67
1. Visit this link (https://www.w3schools.com/colors/
colors_rgb.asp). On the basis of this online tool, try and write
answers of all the below-mentioned questions. o What is the
output colour when you put R=G=B=255?
o What is the output colour when you put R=G=255,B=0?
o What is the output colour when you put R=255,G=0,B=255?
o What is the output colour when you put R=0,G=255,B=255?
o What is the output colour when you put R=G=B=0?
o What is the output colour when you Put R=0,G=0,B=255?
o What is the output colour when you Put R=255,G=0,B=0?
o What is the output colour when you put R=0,G=255,B=0?
o What is the value of your colour?
2025/8/1 JYOTSNA VERMA 68
2025/8/1 JYOTSNA VERMA 69