write a program in python to display the grade of student as per instructions given below:
Marks Grade
85 to 100 A
61 to 84 B+
41 to 60 B
30 to 40 C
Below 30 Fail
Note- if marks entered Greater than 100 will be treated as Wrong input
Answers
Answer:
Explanation:
. User must enter 5 different values and store it in separate variables.
2. Then sum up all the five marks and divide by 5 to find the average of the marks.
3. If the average is greater than 90, “Grade: A” is printed.
4. If the average is in between 80 and 90, “Grade: B” is printed.
5. If the average is in between 70 and 80, “Grade: C” is printed.
6. If the average is in between 60 and 70, “Grade: D” is printed.
7. If the average is anything below 60, “Grade: F” is printed.
Required Answer:-
Question:
- Write a program in Python to display the grade of a student as per the given instructions.
Solution:
Here comes the program.
n=float(input("Enter your marks: "))
if n < 0 or n > 100:
print("Invalid Marks.")
else:
g=""
if n>=85:
g="A"
elif n>=61:
g="B+"
elif n>=41:
g="B"
elif n>=30:
g="C"
else:
g="Fail"
print("Your grade: ",g)
Algorithm:
- START
- Accept the marks.
- Check if the marks is valid or not.
- Calculate and display the grade as per the given condition.
- STOP.
Refer to the attachment for output ☑.