Skip to main content

Featured

Introduction to Numpy Library in Python

Introduction to Numpy Library in Python NUMPY - Introduction Introduction     NUMPY stands for Numerical Python. Numpy is one of the libraries for the python programming language. It is used for high level mathematical calculations. It has the large collection of functions for working with the multi-dimensional arrays, matrices, linear algebra, Fourier transform, etc. Installation of Numpy 1. Open the command or terminal on your system. 2. Enter the following command below.      #installation of NUMPY using PIP      pip install numpy       (OR)       #installation of NUMPY using CONDA      conda install numpy 3. Now, NUMPY installed on your system. To verify that use the command below.      #check for version of NUMPY      numpy --version  Tip : Use Anaconda Navigator , it comes with built-in software of JUPYTER NOTEBOOKS and pre-installed packages like Nump...

Program for Student Grade Calculation in Python

Python - Student Grade Calculation

Python - Student Grade Calculation
Python - Student Grade Calculation


Source Code

Aim :

    To write a program to take in the marks of 5 subjects and display the grade in python

Algorithm :

  • Get the required input from the user by using input statement for 'a' represents the first subject, 'b' represents the second subject, 'c' represents the third subject, 'd' represents the fourth subject, 'e' represents the fifth subject and 'avg' represents average.
  • Program for Student Grade Calculation using the following 'if' statement condition and 'elif' statement condition.
  • Display the result with the help of print statement

Program :

#Program to take in the marks of 5 subjects and display the grade
#'a' represents the first subject, 'b' represents the second subject, 'c' represents the third subject,
#'d' represents the fourth subject, 'e' represents the fifth subject and 'avg' represents average
#and get input from user

a = int(input("Enter marks of the first subject : "))
b = int(input("Enter marks of the second subject : "))
c = int(input("Enter marks of the third subject : "))
d = int(input("Enter marks of the fourth subject : "))
e = int(input("Enter marks of the fifth subject : "))

avg = (a+b+c+d+e)/5

if(avg>=90):
    print("Grade - A")
elif(avg>=80 and avg<90):
    print("Grade - B")
elif(avg>=70 and avg<80):
    print("Grade - C")
elif(avg>=60 and avg<70):
    print("Grade - D")
else:
    print("Grade - F")

Output :

Enter marks of the first subject : 
100
Enter marks of the second subject : 
100
Enter marks of the third subject : 
100
Enter marks of the fourth subject : 
100
Enter marks of the fifth subject : 
100
Grade - A

Terminal Code :

Python - Student Grade Calculation Program01
Python - Student Grade Calculation Program01

Python - Student Grade Calculation Program02
Python - Student Grade Calculation Program02


Terminal Output :

Python - Student Grade Calculation Output
Python - Student Grade Calculation Output


Result :

    The output was executed successfully and result was verified.


Personal Writings for Readers!!!

Story behind single family described in Pandemic Family Book.


Read more on...

Paperback - https://amzn.to/34NS6Sk

Amazon Kindle - https://amzn.to/3aKtIng

Kobo Writing - https://bit.ly/3iQysNy

Comments

Popular Posts