Quizzma Latest Questions

For this final, you will be writing a program that will compute a user’s semester grade. A semester grade is calculated with the following weighted quarters and final: quarter 1 – 40%, quarter 2 – 40%, and the semester final – 20%. Once calculated, you must add them together and print out the user’s grade for the semester, not just their percent. Use the float function when getting input. The grades are as follows: A: 89-100 B: 79-88 C: 69-78 D: 59-68 F: <58 What will your program output for the user's semester grade?

For this final, you will be writing a program that will compute a user’s semester grade. A semester grade is calculated with the following weighted quarters and final: quarter 1 – 40%, quarter 2 – 40%, and the semester final – 20%. Once calculated, you must add them together and print out the user’s grade for the semester, not just their percent. Use the float function when getting input. The grades are as follows:

A: 89-100
B: 79-88
C: 69-78
D: 59-68
F: <58




Leave an answer

Leave an answer

What is the capital of Egypt? ( Cairo )

1 Answer

  1. To compute a user’s semester grade based on the given weights, you can use the following Python program. This program will take the user’s input for quarter grades and the final exam, calculate the semester grade, and then determine the corresponding letter grade.

    Here’s the code:

    
    

    # Get user input for grades

    quarter1 = float(input("Enter your Quarter 1 grade: "))

    quarter2 = float(input("Enter your Quarter 2 grade: "))

    final_exam = float(input("Enter your Semester Final grade: "))

    # Calculate the weighted average

    semester_grade = (quarter1 * 0.4) + (quarter2 * 0.4) + (final_exam * 0.2)

    # Determine the letter grade

    if semester_grade >= 89:

    letter_grade = 'A'

    elif semester_grade >= 79:

    letter_grade = 'B'

    elif semester_grade >= 69:

    letter_grade = 'C'

    elif semester_grade >= 59:

    letter_grade = 'D'

    else:

    letter_grade = 'F'

    # Print the results

    print(f"Your semester grade is: {semester_grade:.2f}")

    print(f"Your letter grade is: {letter_grade}")

    ### Explanation:
    1. Input: The program prompts the user to enter grades for Quarter 1, Quarter 2, and the final exam, using the `float` function to ensure that decimal values can be entered.
    2. Calculation:

Related Questions