Question

Write a program that keeps reading a test score until a -1 is entered. The program...

Write a program that keeps reading a test score until a -1 is entered. The program
will output the letter grade according to the table below:
Score Grade
90-100.   A
80-89.   B
70-79.   C
60-69.   D
< 60.   F


For example:
Enter a Score (-1 to Exit): 92
The Letter grade for that score is A.
Enter a Score (-1 to Exit): -1

Homework Answers

Answer #1
while True:
    score = float(input("Enter a score (-1 to Exit): "))
    if score == -1:
        break
    if score >= 90:
        letter_grade = 'A'
    elif score >= 80:
        letter_grade = 'B'
    elif score >= 70:
        letter_grade = 'C'
    elif score >= 60:
        letter_grade = 'D'
    else:
        letter_grade = 'F'
    print("The letter grade for that score is {}.\n".format(letter_grade))

Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
C++ Write a program which accepts a numeric test score from the user. It will output...
C++ Write a program which accepts a numeric test score from the user. It will output the letter grade to the user corresponding to the score. Assume no “minus grades” (an A ranges from 90-100, B ranges from 80-89, C ranges from 70-79, D ranges from 60-69 and F is everything else.) Ensure that the score remains in the range of 0 to 100. As an example of the output: Enter your numeric grade and I will tell you your...
Write a Java program to display a letter grade based on an actual grade. A =...
Write a Java program to display a letter grade based on an actual grade. A = 90-100 B = 80-89 C = 70-79 D = 60-69 F = less than 60 The program needs to do the following: 1. Create a short integer to store a grade. (See Week 3 - Things to Know - Java Data Types ) 2. Prompt for a grade ( 0-100). 3. Based on the grade given, use IF statements to display the letter grade...
Write a Java program to display a letter grade based on an actual grade. USING ECLIPSE...
Write a Java program to display a letter grade based on an actual grade. USING ECLIPSE IDE A = 90-100 B = 80-89 C = 70-79 D = 60-69 F = less than 60 The program needs to do the following: 1. Create a short integer to store a grade. (See Week 3 - Things to Know - Java Data Types ) 2. Prompt for a grade ( 0-100). 3. Based on the grade given, use IF statements to display...
Write a function, grade(score), which is given score, and it returns a letter grade — the...
Write a function, grade(score), which is given score, and it returns a letter grade — the grade for that mark — according to this scheme: A: >= 90 B: [80, 90) C: [70, 80) D: [60, 70) F: < 60 The square and round brackets denote closed and open intervals. A closed interval includes the number, and an open interval excludes it. So 79.99999 gets grade C, but 80 gets grade B. Define the main function as follows: In main,...
Write a code that asks the user her test score (with an inputbox). Then report the...
Write a code that asks the user her test score (with an inputbox). Then report the user her letter grade with a message box. Test score > 90 a Grade is A                              90>=Test score>80 a Grade is B                              80>= Test score >70 a Grade is C                              70>= Test score >60 a Grade is D                              60> Test score a The student failed the test.
-- 3. Create a variable to store a numeric grade -- Write a CASE statement that...
-- 3. Create a variable to store a numeric grade -- Write a CASE statement that uses the variable to calculate a letter grade -- If the numeric grade is above 100 or below 0, return "Invalid grade" -- A = 90-100, B = 80-89, C = 70-79, D = 60-69, F = 0-59 -- Hint: SELECT doesn't always require a FROM clause
Write a program IN PYTHON of the JUPYTER NOOTBOOK Write a Python program that gets a...
Write a program IN PYTHON of the JUPYTER NOOTBOOK Write a Python program that gets a numeric grade (on a scale of 0-100) from the user and convert it to a letter grade based on the following table. Credit Score Annual Intrest Rate 500-649 %15.5 650-729 %9.5 730-800 %4.5 The program should be written so that if the user entered either a non-numeric input or a numeric input out of the 0-100 range, it asks him/her to enter a numeric...
Create a Grade application that prompts the user for the percentage earned on a test or...
Create a Grade application that prompts the user for the percentage earned on a test or other graded work and then displays the corresponding letter grade. The application should use the grading scale at your school or the following grading scale: 90 – 100 A 80 – 89 B 70 – 79 C 60 – 69 D below 60 F The application output should look similar to: Enter your marks: 90 Grade: A Notes: coded in java. Please don't make...
Student Grades Student Test Grade 1 76 62 2 84 90 3 79 68 4 88...
Student Grades Student Test Grade 1 76 62 2 84 90 3 79 68 4 88 84 5 76 58 6 66 79 7 75 73 8 94 93 9 66 65 10 92 86 11 80 53 12 87 83 13 86 49 14 63 72 15 92 87 16 75 89 17 69 81 18 92 94 19 79 78 20 60 71 21 68 84 22 71 74 23 61 74 24 68 54 25 76 97...
The Test Scores for a Statistics course are given in the Excel below. The data (X1,...
The Test Scores for a Statistics course are given in the Excel below. The data (X1, X2, X3, X4) are for each student. X1 = score on exam #1 X2 = score on exam #2 X3 = score on exam #3 X4 = score on final exam Your professor wants to know if all tests are created equal. What is the F-Stat? EXAM1 EXAM2 EXAM3 FINAL 73 80 75 65.86667 93 88 93 80.16667 89 91 90 78 96 98...