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

Grade X Python Program

The document contains a list of Python programs designed for Class X students, showcasing various functionalities such as creating and displaying lists, summing elements, adding and concatenating lists, and visualizing data with bar, line, and scatter charts using matplotlib. Each program includes user input prompts and example outputs for clarity. The programs cover fundamental programming concepts and data visualization techniques.
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)
2 views4 pages

Grade X Python Program

The document contains a list of Python programs designed for Class X students, showcasing various functionalities such as creating and displaying lists, summing elements, adding and concatenating lists, and visualizing data with bar, line, and scatter charts using matplotlib. Each program includes user input prompts and example outputs for clarity. The programs cover fundamental programming concepts and data visualization techniques.
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

List of Python Program Class X –AI 202526

# Program 1 : Write a Program to create an numbered list and display its element
l=[]
n=int(input("Enter how many elements you want in the list: "))
for i in range(0,n):
x=int(input("Enter number "))
[Link](x)
print("Here is your List : ", l)

Output :
Enter how many elements you want in the list: 4
Enter number 1
Enter number 3
Enter number 5
Enter number 6
Here is your List : [1, 3, 5, 6]

# Program 2 : Write a Program to create an numbered list and display its element
l=[]
s=0
n=int(input("Enter how many elements you want in the list: "))
for i in range(0,n):
x=int(input("Enter number "))
[Link](x)
s=s+x
print("Here is your List : ", l)
print("Sum of all element in the list is ", s)

Output :
Enter how many elements you want in the list: 4
Enter number 12
Enter number 2
Enter number 4
Enter number 5
Here is your List : [12, 2, 4, 5]
Sum of all element in the list is 23

# Program 3 : Write a Program to add two lists and display its element
l1=[2,3,4,5]
l2=[10,4,56,8]
l3=list()
print("First list : ", l1)
print("Second list : ", l2)
if len(l1)==len(l2):
for i in range (0,len(l1),1):
[Link](l1[i]+l2[i])
else:
print("To add two list it should be of same length")
print("Sum of two list is : ", l3)
Output :
First list : [2, 3, 4, 5]
Second list : [10, 4, 56, 8]
Sum of two list is : [12, 7, 60, 13]
Page 1 of 4
# Program 4 : Write a Program to concatenate and repeat two lists and display its element
list1=[2,3,4,5]
list2=[10,4,56,8]
print("First list : ", list1)
print("Second list : ", list2)
cl=list1+list2
rl1=list1*3
rl2=list2*3
print("Concatenated List is: ", cl)
print("Repeated List 1 is: ", rl1)
print("Repeated List 2 is: ", rl2)

Output :

First list : [2, 3, 4, 5]


Second list : [10, 4, 56, 8]
Concatenated List is: [2, 3, 4, 5, 10, 4, 56, 8]
Repeated List 1 is: [2, 3, 4, 5, 2, 3, 4, 5, 2, 3, 4, 5]
Repeated List 2 is: [10, 4, 56, 8, 10, 4, 56, 8, 10, 4, 56,
8]

# Program 5 : Write a Program to display Bar chart


import [Link] as plt
Country=["India","Russia","USA","Australia"]
Medal=[10,14,5,8]
# Create the line plot
[Link](Country,Medal)
# Add labels and title for clarity
[Link]("Medal Tally")
[Link]("Country")
[Link]("Medal")
# Display the plot
[Link]()

Output :

Page 2 of 4
# Program 6 : Write a program to display line chart from (2,5) to (9,10).
import [Link] as plt
# Define the x and y coordinates of the two points
x_values = [2, 9]
y_values = [5, 10]
# Create the line plot
[Link](x_values, y_values, marker='o', linestyle='-', color='blue')
# Add labels and title for clarity
[Link]("X-axis")
[Link]("Y-axis")
[Link]("Line Chart from (2,5) to (9,10)")
# Add a grid for better readability
[Link](True)
# Display the plot
[Link]()

Output :

# Program 7 : Write a program to display a scatter chart for the following points (2,5), (9,10),(8,3),(5,7),(6,18).
import [Link] as plt
# Define the data points for the scatter plot
# The first list represents the x-coordinates
x_coordinates = [2, 9, 8, 5, 6]
# The second list represents the y-coordinates
y_coordinates = [5, 10, 3, 7, 18]
# Create the scatter plot
# [Link]() takes the x and y coordinates as arguments
[Link](x_coordinates, y_coordinates)

Page 3 of 4
# Add a title to the chart
[Link]('Scatter Chart of Given Points')
# Add labels to the x and y axes
[Link]('X-axis')
[Link]('Y-axis')
# Display the plot
[Link]()

Output :

Page 4 of 4

You might also like