Numpy Python Mini Projects: Student Marks Analyzer

#Mini Project 1: Student Mark Analyzer

  • Create a Numpy Project to implements Student Marks Analysis. It creates a set of students as array. It includes the students name and marks.
  • Find the average, minimum and maximum marks. Print the values.
  • Check for passed students, failed students and distinction students.
  • If the mark is greater than 40, then the student passed the exam. Otherwise, the student failed in the exam.
  • For finding the distinction, check the mark is greater than 75. Finally, print the results.
  • Let us print the grade based on the marks.
  • If the mark is greater than or equal to 90, grade is ‘A+’. Else, if the mark is greater than or equal to 75,then the grade is ‘A’. Else if, the mark is greater than 60,the grade is ‘B’. else if the mark is less than 40, the student’s grade is ‘C’ and ‘F’.
  • Finally, print the grade.

Complete Program

import numpy as np1

# Student data creation

students = np1.array([

    "Ajay",

    "Bob",

    "Charu",

    "Deepika",

    "Angel",

    "Fathima",

    "Hariharan",

    "Sutha"

])

s_marks = np1.array([85, 35, 68, 27, 45, 75, 67, 91])

# Statistics process

s_avg = np1.mean(s_marks)

s_high = np1.max(s_marks)

s_low = np1.min(s_marks)

print("===== STUDENT MARKS Analyzer REPORT =====")

print("Total Students :", len(students))

print("Average Marks  :", s_avg)

print("Highest Marks  :", s_high)

print("Lowest Marks   :", s_low)

# Pass Students details

pass_students = students[s_marks >= 40]

# Fail Students details

fail_students = students[s_marks < 40]

# Distinction Students details

distinction_students = students[s_marks >= 75]

print("\nPassed Students:")

print(pass_students)

print("\nFailed Students:")

print(fail_students)

print("\nDistinction Students:")

print(distinction_students)

#grade

print("\nGrades of the students:")

grades = np1.where(s_marks >= 90, "A+",

         np1.where(s_marks >= 75, "A",

         np1.where(s_marks >= 60, "B",

         np1.where(s_marks >= 40, "C", "F"))))

print(grades)

Output:

===== STUDENT MARKS Analyzer REPORT =====

Total Students : 8

Average Marks  : 61.625

Highest Marks  : 91

Lowest Marks   : 27

 

Passed Students:

['Ajay' 'Charu' 'Angel' 'Fathima' 'Hariharan' 'Sutha']

 

Failed Students:

['Bob' 'Deepika']

 

Distinction Students:

['Ajay' 'Fathima' 'Sutha']

 

Grades of the students:

['A' 'F' 'B' 'F' 'C' 'A' 'B' 'A+']

This is the way of implementing the Student Mark Analyzer in Numpy using Python. Hope, this code is useful to you. Keep Coding!!!!

Comments

Popular posts from this blog

How to create a XML DTD for displaying student details

Employee record management in C

Datatypes and Variables in java script