Knowee
Questions
Features
Study Tools

Write a program to prompt for a score between 0.0 and 1.0. If the score is out of range, print an error. If the score is between 0.0 and 1.0, print a grade using the following table:Score Grade>= 0.9 A>= 0.8 B>= 0.7 C>= 0.6 D< 0.6 FIf the user enters a value out of range, print a suitable error message and exit. For the test, enter a score of 0.85.

Question

Write a program to prompt for a score between 0.0 and 1.0. If the score is out of range, print an error. If the score is between 0.0 and 1.0, print a grade using the following table:Score Grade>= 0.9 A>= 0.8 B>= 0.7 C>= 0.6 D< 0.6 FIf the user enters a value out of range, print a suitable error message and exit. For the test, enter a score of 0.85.

🧐 Not the exact question you are looking for?Go ask a question

Solution

Here is a Python program that fulfills your requirements:

score = input("Enter Score: ")
s = float(score)

if s >= 0.9 and s <= 1.0:
    print('A')
elif s >= 0.8 and s < 0.9:
    print('B')
elif s >= 0.7 and s < 0.8:
    print('C')
elif s >= 0.6 and s < 0.7:
    print('D')
elif s < 0.6 and s >= 0.0:
    print('F')
else:
    print("Error: Score is out of range. Please enter a score between 0.0 and 1.0.")

You can run this program and enter the score when prompted. If you enter 0.85, it will print 'B'.

This problem has been solved

Similar Questions

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

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

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.

What does the following code print if the user enters 15?num = input("Enter a number between 1-100: ")if(num<1 or num>100):     print("Fail: The number is not between 1 and 100 ")else:     print("Thank you for following directions!")print("Thank you for playing!")Group of answer choicesNothing. There is an errorFail: The number is not between 1 and 100Fail: The number is not between 1 and 100 Thank you for playing!Thank you for following directions! Thank you for playing

Single File Programming QuestionProblem StatementAlice is tracking her academic performance. She scored 5 in a quiz (an integer), received a grade of 5.99 in a project (a float value), and was assigned a grade 'D' for her assignment (a character). Create a C program to print these values with appropriate data types in separate lines.Input format :No console input.Output format :The first line displays an integer representing the score of Alice's quiz.The second line displays a float value representing the grade of Alice's project.The third line displays a character representing the grade of Alice's assignment.Refer to the sample output for the formatting specifications.Sample test cases :Input 1 :Output 1 :55.990000D

1/3

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.