Python Program to Print Grade Based on Percentage

Python Program to Print Grade Based on Percentage

Write Python Program to Print Grade Based on Percentage

# Python Program to Print Grade Based on Percentage

Percentage = float(input("Enter the percentage :--> "))

if Percentage < 33.0:
    print("Oops! You are failed")

elif Percentage >= 33.0 and Percentage <= 40.0 :
    print("You have passed the exam with D Grade")

elif Percentage >= 41.0 and Percentage <= 50.0 :
    print("You have passed the exam with C2 Grade")

elif Percentage >= 51.0 and Percentage <= 60.0 :
    print("You have passed the exam with C1 Grade")

elif Percentage >= 61.0 and Percentage <= 70.0 :
    print("You have passed the exam with B2 Grade")

elif Percentage >= 71.0 and Percentage <= 80.0 :
    print("You have passed the exam with B1 Grade")

elif Percentage >= 81.0 and Percentage <= 90.0 :
    print("You have passed the exam with A2 Grade")

elif Percentage >= 91.0 and Percentage <= 100.0 :
    print("You have passed the exam with A1 Grade")

else :
    print("Please Enter the percentage in the range of 0 to 100")

Output:

Run 1:
Enter the percentage :-->  23.26
Oops! You are failed

Run 2:
Enter the percentage :-->  85.23
You have passed the exam with A1 Grade

Run 3:
Enter the percentage :-->  65.00
You have passed the exam with B2 Grade