Ask Question
18 August, 22:41

Using Python I need to Prompt the user to enter in a numerical score for a Math Class. The numerical score should be between 0 and 100. Prompt the user to enter in a numerical score for a English Class. The numerical score should be between 0 and 100. Prompt the user to enter in a numerical score for a PE Class. The numerical score should be between 0 and 100. Prompt the user to enter in a numerical score for a Science Class. The numerical score should be between 0 and 100. Prompt the user to enter in a numerical score for an Art Class. The numerical score should be between 0 and 100. Call the letter grade function 5 times (once for each class). Output the numerical score and the letter grade for each class.

+4
Answers (1)
  1. 19 August, 00:19
    0
    The program doesn't use comments; See explanation section for detailed line by line explanation

    Program starts here

    def lettergrade (subject, score):

    print (subject+": "+str (score))

    if score > = 90 and score < = 100:

    print ("Letter Grade: A")

    elif score > = 80 and score < = 89:

    print ("Letter Grade: B")

    elif score > = 70 and score < = 79:

    print ("Letter Grade: C")

    elif score > = 60 and score < = 69:

    print ("Letter Grade: D")

    elif score > = 0 and score < = 59:

    print ("Letter Grade: F")

    else:

    print ("Invalid Score")

    maths = int (input ("Maths Score: "))

    english = int (input ("English Score: "))

    pe = int (input ("PE Score: "))

    science = int (input ("Science Score: "))

    arts = int (input ("Arts Score: "))

    lettergrade ("Maths Class: ", maths)

    lettergrade ("English Class: ", english)

    lettergrade ("PE Class: ", pe)

    lettergrade ("Science Class: ", science)

    lettergrade ("Arts Class: ", arts)

    Explanation:

    The program makes the following assumptions:

    Scores between 90-100 has letter grade A

    Scores between 80-89 has letter grade B

    Scores between 70-79 has letter grade C

    Scores between 60-69 has letter grade D

    Scores between 0-69 has letter grade E

    Line by Line explanation

    This line defines the lettergrade functions; with two parameters (One for subject or class and the other for the score)

    def lettergrade (subject, score):

    This line prints the the score obtained by the student in a class (e. g. Maths Class)

    print (subject+": "+str (score))

    The italicized determines the letter grade using if conditional statement

    This checks if score is between 90 and 100 (inclusive); if yes, letter grade A is printed

    if score > = 90 and score < = 100:

    print ("Letter Grade: A")

    This checks if score is between 80 and 89 (inclusive); if yes, letter grade B is printed

    elif score > = 80 and score < = 89:

    print ("Letter Grade: B")

    This checks if score is between 70 and 79 (inclusive); if yes, letter grade C is printed

    elif score > = 70 and score < = 79:

    print ("Letter Grade: C")

    This checks if score is between 60 and 69 (inclusive); if yes, letter grade D is printed

    elif score > = 60 and score < = 69:

    print ("Letter Grade: D")

    This checks if score is between 0 and 59 (inclusive); if yes, letter grade F is printed

    elif score > = 0 and score < = 59:

    print ("Letter Grade: F")

    If input score is less than 0 or greater than 100, "Invalid Score" is printed

    else:

    print ("Invalid Score")

    This line prompts the user for score in Maths class

    maths = int (input ("Maths Score: "))

    This line prompts the user for score in English class

    english = int (input ("English Score: "))

    This line prompts the user for score in PE class

    pe = int (input ("PE Score: "))

    This line prompts the user for score in Science class

    science = int (input ("Science Score: "))

    This line prompts the user for score in Arts class

    arts = int (input ("Arts Score: "))

    The next five statements is used to call the letter grade function for each class

    lettergrade ("Maths Class: ", maths)

    lettergrade ("English Class: ", english)

    lettergrade ("PE Class: ", pe)

    lettergrade ("Science Class: ", science)

    lettergrade ("Arts Class: ", arts)
Know the Answer?
Not Sure About the Answer?
Get an answer to your question ✅ “Using Python I need to Prompt the user to enter in a numerical score for a Math Class. The numerical score should be between 0 and 100. ...” in 📙 Computers & Technology if there is no answer or all answers are wrong, use a search bar and try to find the answer among similar questions.
Search for Other Answers