7. Write a python program to
read the mark of a student and
to display the grade as per the
following criteria: 80-100 A
grade, 60 -79 B grade, 40-59
C grade, below 40 D grade. *
Answers
Answer:
try:
grade = int(input("Enter Your Grade - "))
# We have stored grade in grade variable
if grade > 40:
print("D")
elif grade < 59 and grade >= 40:
print("C")
elif grade < 79 and grade >= 60:
print("B")
elif grade > 80 and grade <= 100:
print("A")
#We have checked the condition
except ValueError:
print("Enter an integer value")
#Handling The Error
hope This will be helpful for you :)
Question:-
Write a python program to read the mark of a student and display the grade as per the following criteria,
80-100 A
69-79 B
40-59 C
<40 D
Code:-
g=int(input("Enter your Marks: "))
if g<40:
print("D")
elif g>=40 and g<59:
print("C")
elif g>=69 and g<=79:
print("B")
elif g>=80 and g<=100:
print("A")