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

Python Practical File 15 Programs

The document is a practical file for a Python class containing 15 programming exercises. Each exercise includes a brief description, code snippets for various tasks involving lists, NumPy arrays, data visualization with Matplotlib, and CSV file handling. Additionally, there are placeholders for output screenshots for each program.

Uploaded by

sarashadab.2011
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 views3 pages

Python Practical File 15 Programs

The document is a practical file for a Python class containing 15 programming exercises. Each exercise includes a brief description, code snippets for various tasks involving lists, NumPy arrays, data visualization with Matplotlib, and CSV file handling. Additionally, there are placeholders for output screenshots for each program.

Uploaded by

sarashadab.2011
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

Python Practical File (15 Programs)

Name: ____________ Class: X

1. Add elements of two lists


list1=[1,2,3,4]
list2=[5,6,7,8]
result=[a+b for a,b in zip(list1,list2)]
print(result)

Output Screenshot: ____________________________ (Paste screenshot here)

2. 2-D NumPy array (2x5) of zeros


import numpy as np
a=[Link]((2,5),dtype=int)
print(a)

Output Screenshot: ____________________________ (Paste screenshot here)

3. 3-D NumPy array (3x2x2) random numbers


import numpy as np
a=[Link](3,2,2)
print(a)

Output Screenshot: ____________________________ (Paste screenshot here)

4. 5x5 array filled with 10


import numpy as np
a=[Link]((5,5),10)
print(a)

Output Screenshot: ____________________________ (Paste screenshot here)

5. Multiples of 5 between 30 and 70


import numpy as np
a=[Link](35,70,5)
print(a)

Output Screenshot: ____________________________ (Paste screenshot here)

6. NumPy arithmetic
import numpy as np
a=[Link]([10,20,30]); b=[Link]([2,4,5])
print(a+b); print(a-b); print(a*b); print(a/b)
Output Screenshot: ____________________________ (Paste screenshot here)

7. Mean, Median, Mode


import numpy as np
from statistics import mode
a=[Link]([1,2,2,3,4,5])
print([Link](a)); print([Link](a)); print(mode(a))

Output Screenshot: ____________________________ (Paste screenshot here)

8. Line chart
import [Link] as plt
[Link]([2,9],[5,10])
[Link]()

Output Screenshot: ____________________________ (Paste screenshot here)

9. Scatter chart
import [Link] as plt
x=[2,9,8,5,6]; y=[5,10,3,7,18]
[Link](x,y)
[Link]()

Output Screenshot: ____________________________ (Paste screenshot here)

10. Read CSV and display 10 rows


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

Output Screenshot: ____________________________ (Paste screenshot here)

11. CSV information


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

Output Screenshot: ____________________________ (Paste screenshot here)

12. Read and display image


import [Link] as plt
import [Link] as mpimg
img=[Link]('[Link]')
[Link](img); [Link]()

Output Screenshot: ____________________________ (Paste screenshot here)


13. Image shape
import cv2
img=[Link]('[Link]')
print([Link])

Output Screenshot: ____________________________ (Paste screenshot here)

14. Sum of array elements


import numpy as np
a=[Link]([2,4,6,8])
print([Link](a))

Output Screenshot: ____________________________ (Paste screenshot here)

15. Maximum and Minimum


import numpy as np
a=[Link]([12,5,18,7])
print([Link](a)); print([Link](a))

Output Screenshot: ____________________________ (Paste screenshot here)

You might also like