A school has following rules for grading system: a. Below 25 - F b. 25 to 45 - E c. 45 to 50 - D d. 50 to 60 - C e. 60 to 80 - B f. Above 80 - A Ask user to enter marks and print the corresponding grade.
Question
A school has following rules for grading system: a. Below 25 - F b. 25 to 45 - E c. 45 to 50 - D d. 50 to 60 - C e. 60 to 80 - B f. Above 80 - A Ask user to enter marks and print the corresponding grade.
Solution
Sure, here is a simple Python program that takes user input for marks and prints the corresponding grade according to the grading system you provided:
# Ask user to enter marks
marks = float(input("Enter your marks: "))
# Check the grade according to the marks
if marks < 25:
grade = 'F'
elif 25 <= marks < 45:
grade = 'E'
elif 45 <= marks < 50:
grade = 'D'
elif 50 <= marks < 60:
grade = 'C'
elif 60 <= marks < 80:
grade = 'B'
else:
grade = 'A'
# Print the grade
print("Your grade is: ", grade)
This program first asks the user to enter their marks. It then checks which range the marks fall into according to the grading system and assigns the corresponding grade. Finally, it prints the grade.
Similar Questions
Accept the grades from the user and display the grade according to the following criteria:Below 25 --D25 to 45 -- C45 to 50 -- B50 to 60 --B+60 to 80 -- AAbove 80 -- A+
Write a Java program that determines a student’s grade. The program will read three types ofscores(quiz, mid-term, and final scores) and determine the grade based on the following rules: -if theaverage score >=90% =>grade=A -if the average score >= 70% and <90% => grade=B -if theaverage score>=50% and <70% =>grade=C -if the average score<50% =>grade=F
A student marking system receives input of student’s total mark from lecturer. If a studentgets total mark of 75 or above, the system will print ‘A’. If a student’s mark is between 65 to74, the system will print out ‘B’. While ‘C’ will be printed out if the mark is between 50 to 64.Whichever the total mark is below 50, ‘F’ will be printed
Problem StatementA computer science teacher assigned the students a programming task that calculates and displays grades based on test marks. The teacher wants the program to take a student's test mark as input and determine their grade using the following criteria:If the mark is between 90 and 100 (inclusive), assign grade A.If the mark is between 80 and 89 (inclusive), assign grade B.If the mark is between 70 and 79 (inclusive), assign grade C.If the mark is between 60 and 69 (inclusive), assign grade D.If the mark is between 45 and 59 (inclusive), assign grade E.For marks below 45 assign grade F.If the mark is greater than 100 or a negative number, it displays "Invalid input". Help the students to accomplish the given task.Note: This question helps in clearing AMCAT exam.Input format :The input consists of a single integer, representing the student's mark.Output format :The output displays "Grade: " followed by the grade for the given mark based on the given criteria.If the mark is greater than 100 or a negative number, the output displays "Invalid input".Refer to the sample output for the formatting specifications.Code constraints :In the given scenario, the test cases fall under the following constraints:0 ≤ student's mark ≤ 100Sample test cases :Input 1 :100Output 1 :Grade: AInput 2 :85Output 2 :Grade: BInput 3 :79Output 3 :Grade: CInput 4 :63Output 4 :Grade: DInput 5 :56Output 5 :Grade: EInput 6 :0Output 6 :Grade: FInput 7 :-5Output 7 :Invalid inputInput 8 :126Output 8 :Invalid input
As a python student, write a program using functions and conditions to display the grades that the students will be receiving. The grades are:90% - 100% Grade is A 80% - 89% Grade is B70% - 79% Grade is C 60% - 69% Grade is D 50% - 59% Grade is E <50% Fail
Upgrade your grade with Knowee
Get personalized homework help. Review tough concepts in more detail, or go deeper into your topic by exploring other relevant questions.