Python Print Grade From Score if elif else

By | March 19, 2020

Python Print Grade From Score if elif else

# Write a Python program
# using if-elif-else to print
# the grade based on
# score input by the user

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

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

score = int(input("Enter score: "))

if score >= 80:
    grade = 'A'
elif score >= 70:
    grade = 'B'
elif score >= 55:
    grade = 'C'
elif score >= 50:
    grade = 'Pass'
else:
    grade = 'Fail'
print ("\nGrade is: " + grade)

Output

Enter score: 85

Grade is: A  

Loading

Leave a Reply

Your email address will not be published. Required fields are marked *