Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

grading system in python with nested if

# Write a Python program
# using nested if else statement
# to print the grade based on marks
# input by the user

# Perfect Python Programming Tutorials
# Author : www.EasyCodebook.com (c)

# Actual Program starts here 
# Python Program - Print Your Grade using nested if

marks = input("Enter Marks Obtained: ")
marks = int(marks)
if marks >= 80:
    grade = 'A'
else:
    if marks >= 70:
        grade = 'B'
    else:
        if marks >= 55:
            grade = 'C'
        else:
            if marks >= 50:
                grade = 'Pass'
            else:
                 grade = 'Fail'
print ("
Your Grade is: " + grade)
Source by easycodebook.com #
 
PREVIOUS NEXT
Tagged: #grading #system #python #nested
ADD COMMENT
Topic
Name
6+4 =