Question

This question was answered by someone else but their code doesn't work when I try to run it.

Q1. Currently, you are enrolled in the Spring semester and taking five courses. Write a program that asks the user to enter t

0 0
Add a comment Improve this question Transcribed image text
Answer #1

PYTHON PROGRAM

The comments are mentioned in grey and italic.

Kindly note the three logical concerns with the question:

1. 90 is being considered for grade A and grade B. So, I have coded with 90-100 as grade A and 80-89 as grade B.

2. The explanation of the total points in the usual GPA calculation method is points*credits. That is not mentioned. I have computed that way. If you don't want the multiplication part, kindly remove that as I have mentioned it clearly in comments.

3. Usually the points for grade A will be 10 to obtain a gpa on a scale of 10 but it is mentioned as 12 in the question. I have mentioned as 12 only in the program.

Kindly use the comment section for further clarification if needed.

def calculate_GPA(score):
    #Since five courses and three credit hours
    #gpa= total points earned/total credits
    #Total points=Sum of (points*credits) for each subject
    #Total credits=5*3=15
    #Kindly note usually total points is calculated this way.
    #If you don't want the multiplication with credits,remove that in the line before function call
    return score/15 
def determine_grade(score):
    #For a given score, the statement is printed and letter grade is returned
    if score>=90 and score<=100:
        print("Excellent")
        return "A"
    elif score>=80 and score<=89:
        #Kindly check in Question - 90 is considered in both cases 90-100 and 80-90
        print("Above Average")
        return "B"
    elif score>=70 and score<=79:
        print("Average")
        return "C"
    elif score>=60 and score<=69:
        print("Below Average")
        return "D"
    elif score<60:
        print("Fail")
        return "F"
#List points to hold the points earned for each course
points=[]
for i in range(5):
    print("Enter your marks for course",i+1)
    #Get mark from user
    mark=int(input())
    #Print grade and statement
    grade=determine_grade(mark)
    print("Grade:",grade)
    # Compute the points earned
    if grade=="A":
        point=12 #Kindly check if this is 12!!! Because, logically it has to be 10. 
    elif grade=="B":
        point=9
    elif grade=="C":
        point=6
    elif grade=="D":
        point=3
    elif grade=="F":
        point=0
    #Usually, total points is calculated by points*credit
    #In case, if that's not your expectation, remove *3 in the following line
    points.append(point*3)
#Print the GPA
print("Spring Semester GPA:",calculate_GPA(sum(points)))
    

    

SCREENSHOT OF CODE TO ASSIST IN INDENTATION

def calculate GPA (Score) : #Since five courses and three credit hours #gpa= total points earned/total credits #Total points=

#List points to hold the points earned for each course points=[] for i in range (5): print (Enter your marks for course,i+1

OUTPUT SCREENSHOT

Enter your marks for course 1 100 Excellent Grade: A Enter your marks for course 2 80 Above Average Grade: B Enter your marks

Add a comment
Know the answer?
Add Answer to:
This question was answered by someone else but their code doesn't work when I try to...
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. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Write python code on computer, No handwritten code You will implement a program which asks the...

    Write python code on computer, No handwritten code You will implement a program which asks the user to enter scores of different courses in different semesters. The program should read the input and output some simple statistics 1. An example input string by the user is given below. Fal12016-coursel:82, course2:80,course3:85;Spring2018- course4:82;Fall2018-course5:85, course6:50, course7:78 Info from different semesters are separated by a ";", courses in each semester are separated by a,and score and corresponding course is separated by a, information of...

  • Write a program that asks the user to enter five test scores. The program should display...

    Write a program that asks the user to enter five test scores. The program should display a letter grade for each score and the average test score. Design the following functions in the program: calcAverage—This function should accept five test scores as arguments and return the average of the scores. determineGrade—This function should accept a test score as an argument and return a letter grade for the score (as a String), based on the following grading scale: Score Letter Grade...

  • Solve This Problem using python and please comment on every line. also, use function to solve...

    Solve This Problem using python and please comment on every line. also, use function to solve this. thanks The result will be like as below: Write a program that asks the user to enter five test scores. The program should display a letter grade for each score and the average test score. Write the following functions in the program: This function should accept five test scores as arguments and return the average of the scores. This function should accept a...

  • Design a function named max that accepts two integer values as arguments and returns the value...

    Design a function named max that accepts two integer values as arguments and returns the value that is the greater of the two. For example, if 7 and 12 are passed as arguments to the function, the function should return 12. Use the function in a program that prompts the user to enter two integer values. The program should display the value that is the greater of the two. Need Variable lists, Psuedocode, ipo chart, Flow Chart, and a python...

  • Write a grading program for the following grading policies:- a. There are two quizzes, each graded...

    Write a grading program for the following grading policies:- a. There are two quizzes, each graded on the basis of 10 points. b. There is one midterm exam and one final exam, each graded on the basis of 100 points. c. The final exam counts for 50 percent of the grade, the midterm counts for 25 percent and the two quizzes together count for a total of 25 percent. Grading system is as follows:- >90 A >=80 and <90 B...

  • Write a program that asks the user to enter five test scores. The program should display...

    Write a program that asks the user to enter five test scores. The program should display a letter grade for each score and the average test score. Design the following functions in the program: calcAverage—This function should accept five test scores as arguments and return the average of the scores. determineGrade—This function should accept a test score as an argument and return a letter grade for the score (as a String), based on the following grading scale: Round the average...

  • using if/switch statements (C++) Write a grading program for a class with the following grading policies:...

    using if/switch statements (C++) Write a grading program for a class with the following grading policies: There are two quizzes, each graded on the basis of 10 points There is one midterm exam and one final exam, each graded on the basis of 100 points The final exam counts for 50% of the grade, the midterm counts for 25% and the two quizzes together count for a total of 25%. (Do not forget to normalize the quiz scores. They should...

  • Write a javascript program that asks the user to enter five test scores. The program should...

    Write a javascript program that asks the user to enter five test scores. The program should display a letter grade for each score and the average test score. Write the following methods in the program: calcAverage—This method should accept five test scores as arguments and return the average of the scores. determineGrade—This method should accept a test score as an argument and return a letter grade for the score,

  • Write a grading program in Java for a class with the following grading policies: There are...

    Write a grading program in Java for a class with the following grading policies: There are three quizzes, each graded on the basis of 10 points. There is one midterm exam, graded on the basis of 100 points. There is one final exam, graded on the basis of 100 points. The final exam counts for 40% of the grade. The midterm counts for 35% of the grade. The three quizzes together count for a total of 25% of the grade....

  • I asked a question similar to this one, which was answered perfectly. Another practice problem is...

    I asked a question similar to this one, which was answered perfectly. Another practice problem is now asking me to use two classes and get user input. For this Java program, you will write two classes: GradeCalculator and GradeCalculatorDriver In the GradeCalculator class, compute the final average and letter grade for a particular student. The final average is calculated according to the following rules: 1) There are ten exams scored out of 100 points 2) The lowest exam score is...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT