0% found this document useful (0 votes)
21 views2 pages

Python Lab 10

The document outlines a program to analyze student performance using the NumPy library in Python. It includes data on study hours and exam scores, and demonstrates how to calculate mean, median, standard deviation, and correlation. The program has been successfully implemented and verified.

Uploaded by

Athish Vishnu
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)
21 views2 pages

Python Lab 10

The document outlines a program to analyze student performance using the NumPy library in Python. It includes data on study hours and exam scores, and demonstrates how to calculate mean, median, standard deviation, and correlation. The program has been successfully implemented and verified.

Uploaded by

Athish Vishnu
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

EX.

NO: 10
71762305009 NUMPY
26.03.2025

AIM:

To implement NumPy library in python to analyze the data.

PROGRAM:

1.A university wants to analyse the performance of students based on their


study hours and previous exam scores.
The university has collected student data as follows:
 study hours ( in hours per week)
[5, 10, 15, 20, 25, 30, 35, 40]
 previous exam scores( out of 100)
[50, 55, 60, 65, 70, 75, 80, 85]
 current exam scores(out of 100)
[52, 60, 67, 70, 75, 78, 85, 90]

1.Using NumPy, store the data in appropriate arrays.


2.Calculate the mean , median and standard deviation of the current exam
scores.
3. Find the correlation between study hours and exam scores using NumPy.

CODE:

import numpy as np
study_hours = np.array([5, 10, 15, 20, 25, 30, 35, 40])
previous_exam_scores = np.array([50, 55, 60, 65, 70, 75, 80, 85])
current_exam_scores = np.array([52, 60, 67, 70, 75, 78, 85, 90])
mean_current_exam_scores = np.mean(current_exam_scores)
median_current_exam_scores = np.median(current_exam_scores)
stddev_current_exam_scores = np.std(current_exam_scores)
correlation = np.corrcoef(study_hours, current_exam_scores)[0,1];
print("Study hours:",study_hours);
print("Previous exam scores:",previous_exam_scores);
print("Current exam scores:",current_exam_scores);
print("Mean of current exam scores:", mean_current_exam_scores)
print("Median of current exam scores:", median_current_exam_scores)
print("Standard Deviation of current exam scores:",
stddev_current_exam_scores)
print("Correlation between study hours and current exam scores:", correlation)

OUTPUT:

RESULT:

The python program using NumPy has been implemented and verified
successfully.

You might also like