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

Class 10 Python Practical Exercises

Uploaded by

astrophysics563
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)
15 views4 pages

Class 10 Python Practical Exercises

Uploaded by

astrophysics563
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

CLASS 10 – AI-417

PYTHON PRACTICAL FILE

Name: ____________
Class: X
Section: ____
Roll No: ____
Program 1: Print Statement
print("Hello, AI World")

Program 2: Variables and Data Types


name="Aditi"
age=15
marks=92.5
print(name, age, marks)

Program 3: Input from User


name=input("Enter name: ")
print("Welcome", name)

Program 4: If-Else (Pass/Fail)


marks=int(input("Enter marks: "))
if marks>=33:
print("Pass")
else:
print("Fail")

Program 5: Even or Odd


num=int(input("Enter number: "))
if num%2==0:
print("Even")
else:
print("Odd")

Program 6: For Loop


for i in range(1,6):
print(i)

Program 7: While Loop


i=1
while i<=5:
print(i)
i+=1

Program 8: List Example


marks=[78,85,90,66]
print(marks)
print(marks[0])

Program 9: Sum of List


numbers=[1,2,3,4,5]
print(sum(numbers))

Program 10: Dictionary Example


student={"name":"Rahul","class":10,"marks":88}
print(student)

Program 11: Function


def add(a,b):
return a+b
print(add(5,3))

Program 12: NumPy Array


import numpy as np
arr=[Link]([1,2,3,4])
print(arr)

Program 13: Pandas DataFrame


import pandas as pd
data={"Name":["Aman","Riya"],"Marks":[85,90]}
df=[Link](data)
print(df)

Program 14: Read CSV File


import pandas as pd
df=pd.read_csv("[Link]")
print(df)

Program 15: Matplotlib Graph


import [Link] as plt
x=[1,2,3,4]
y=[10,20,30,40]
[Link](x,y)
[Link]("X-axis")
[Link]("Y-axis")
[Link]()

Program 16: Mean, Median, Mode


import numpy as np
from statistics import mode
data=[10,20,20,30,40]
print([Link](data))
print([Link](data))
print(mode(data))

You might also like