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...

  • 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...

  • hello. i need help with number 2 ONLY 1. Use if statements to write a Java...

    hello. i need help with number 2 ONLY 1. Use if statements to write a Java program that inputs a single letter and prints out the corresponding digit on the telephone. The letters and digits on a telephone are grouped this way 2=ABC 3 = DEF 4 GHI 5 JKL 6 - MNO 7 - PRS 8 - TUV 9-WXY No digit corresponds to either Qor Z. For these 2 letters your program should print a message indicating that they...

  • Program 5 Due 10/25 C-String and Two-dimensional Array Use An input data file starts with a...

    Program 5 Due 10/25 C-String and Two-dimensional Array Use An input data file starts with a student's name (on one line). Then, for each course the student took last semester, the file has 2 data lines. The course name is on the first line. The second line has the student's grade average (0 to 100) and the number of credits for the course Sample data: Jon P. Washington, Jr. Computer Science I 81 4 PreCalculus 75 3 Biology I 88...

  • Question: How do I write a program in C# that calculates a student's final grade for...

    Question: How do I write a program in C# that calculates a student's final grade for a test with 20 multiple questions using arrays and helper methods? Instructions: (0-incorrect answer, 1-correct answer) If the student answered the question right, add 5 points to the running total. If the student didn’t answer correctly subtract .5 points from the running total. The running total is initialized with 5 points (so the student receives 5 points extra credit). To define the final grade...

  • Write a C++ program that will provide a user with a grade range if they enter...

    Write a C++ program that will provide a user with a grade range if they enter a letter grade. Your program should contain one function. Your function will accept one argument of type char and will not return anything (the return type will be void), but rather print statements to the console. Your main function will contain code to prompt the user to enter a letter grade. It will pass the letter grade entered by the user to your function....

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
ADVERTISEMENT