0% found this document useful (0 votes)
2 views12 pages

Practical Index Class X

The document outlines a practical index for a Class X Artificial Intelligence subject for the session 2024-25, listing various programming tasks and exercises. It includes code examples for checking voting eligibility, calculating student grades, and performing operations on lists and charts using Python. The tasks cover basic programming concepts such as loops, conditionals, and data manipulation with libraries like NumPy and Matplotlib.

Uploaded by

kingkohli171845
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views12 pages

Practical Index Class X

The document outlines a practical index for a Class X Artificial Intelligence subject for the session 2024-25, listing various programming tasks and exercises. It includes code examples for checking voting eligibility, calculating student grades, and performing operations on lists and charts using Python. The tasks cover basic programming concepts such as loops, conditionals, and data manipulation with libraries like NumPy and Matplotlib.

Uploaded by

kingkohli171845
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 12

Practical Index Class X

Subject: Artificial Intelligence


Session 2024-25

S.No. TOPIC Sign/Date


1. WAP to check if a person can vote
2. Wap to check the grade of a student
Input a number and check if the number is positive,
3.
negative or zero and display an appropriate message
4. WAP to print first 10 natural number
5. WAP to print odd numbers from 1 to n
6. WAP to print sum of first 10 natural numbers
Create a list in Python of children selected for science
7.
quiz
8. Create a list num=[23,10,15,90,68,45]

9. Create a list of first 5 even numbers


10. Create a list List_1=[70,80,60,40]
11. WAP to add elements of two list
WAP to calculate mean, median and mode using
12.
numpy
13. WAP to display line chart from (2,5) to (9,10)
WAP to display a scatter chart for the following points
14.
(2,5), (9,10), (8,3), (5,7), (6,18)
Read CSV file saved in your system and display 10
15.
rows
Read csv fille saved in your system and display its
16.
information
17. WAP to read an image and display using python
WAP to read an image and identify its shape using
18.
python
Question 1: WAP to check if a person can vote
Code:

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

if age >= 18:

print("You are eligible to vote.")

else:

print("You are not eligible to vote yet.")

Output:

Question 2: WAP to check the grade of a student

Code:

marks = float(input("Enter the student's total marks: "))

per = (marks/450)*100

if per >= 90:

print("A+")

elif per >= 80:

print("A")

elif per >= 70:


print("B+")

elif per >= 60:

print("B")

elif per >= 50:

print("C")

elif per >= 40:

print("D")

elif per >= 33:

print("E")

else:

print("F")

Output:

Question 3: Input a number and check if the number is positive,


negative or zero and display an appropriate message

Code:

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


if number > 0:
print("The number is positive.")
elif number < 0:
print("The number is negative.")
else:
print("The number is zero.")
Output:

Question 4: WAP to print first 10 natural numbers

Code:

for i in range(1, 11):


print(i)
Output:
Question 5: WAP to print odd numbers from 1 to n

Code:

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

print("Odd numbers from 1 to", n,"are:")

for i in range(1,n+1,2):

print(i)

Output:

Question 6: WAP to print sum of first 10 natural numbers

Code:

sum_of_numbers = 0

for i in range(1, 11):

sum_of_numbers += i

print("Sum of the first 10 natural numbers:", sum_of_numbers)


Output:

Question 7: 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-
i. Print the whole list
ii. Delete the name “Vikram” from the list
iii. Add the name “Jay” at the end
iv. Remove the item which is at the second position.
Code:
children=["Arjun", "Sonakshi", "Vikram", "Sandhya", "Sonal", "Isha",
"Kartik"]
print("Original list:", children)
children.remove("Vikram")
children.append("Jay")
if len(children) > 2:
del children[1]
print("Updated list:", children)

Output:
Question 8: Create a list num=[23,10,15,90,68,45]
i. Print the length of the list
ii. Print the elements from second to fourth position using positive
indexing
iii. Print the elements from position third to fifth using negative indexing

Code:
num=[23, 10, 15, 90, 68, 45]
print("Length of the list:", len(num))
print("Elements from second to fourth position (using positive
indexing):", num[1:4])

print("Elements from third to fifth position (using negative indexing):",


num[-4:-1])

Output:

Question 9: Create a list of first 5 even numbers, add 1 to each list item
and print the final list.
Code:
even_numbers = (2 * i for i in range(1, 6))
final_list = [num + 1 for num in even_numbers]
print(final_list)
Output:

Question 10: Create a list List_1=[70,80,60,40]. Add the elements


[24,25,22] using extend function. Now sort the final list in ascending
order and print it.

Code:

List_1 = [70, 80, 60, 40]


List_1.extend([24, 25, 22])
List_1.sort()
print("Sorted list in ascending order:", List_1)
Output:

Question 11: WAP to add the elements of the two lists

Code:

list1 = [1, 2, 3, 4, 5]

list2 = [6, 7, 8, 9, 10]

if len(list1) != len(list2):

print("Error: Lists have different lengths")


else:

result = []

for i in range(len(list1)):

result.append(list1[i] + list2[i])

print("Sum of the elements of the two lists:", result)

Output:

Question 12: WAP to calculate mean, median and mode using numpy
Code:
import numpy as np
from scipy import stats
data = [10, 15, 20, 25, 30, 35, 40, 45, 50]
mean = np.mean(data)
median = np.median(data)
mode = stats.mode(data)[0]
print("Mean:", mean)
print("Median:", median)
print("Mode:", mode)
Output:
Question 13: WAP to display line chart from (2,5) to (9,10)
Code:

import matplotlib.pyplot as plt

x_values = [2, 9]

y_values = [5, 10]

plt.plot(x_values, y_values)

plt.xlabel('X-axis')

plt.ylabel('Y-axis')

plt.title('Line Chart')

plt.grid(True)

plt.show()

Output:
Question 14: WAP to display a scatter chart for the following points
(2,5), (9,10), (8,3), (5,7), (6,18)
Code:

import matplotlib.pyplot as plt

x_values = [2, 9, 8, 5, 6]

y_values = [5, 10, 3, 7, 18]

plt.scatter(x_values, y_values)

plt.xlabel('X-axis')

plt.ylabel('Y-axis')

plt.title('Scatter Chart')

plt.grid(True)

plt.show()

Output:

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy