Question

In: Computer Science

This program will determine the letter grade for a student. It will ask for scores (could...

This program will determine the letter grade for a student. It will ask for scores (could be labs, activities, quizzes, or projects) and then display some basic statistics derived from the scores.

In Python, Write a program that continuously asks for a non-negative score until the user enters -1. IF the user enters a valid score ask for the possible score for that assignment, we will not assume all scores will have the same maximum value. We will assume that no one will receive a score of 0 on any assignment IF anything it is actually turned in, meaning a score of 0 indicates that the score was not turned it. It’s still the score for the assignment, but this fact will be used later in the assignment. Once all of the scores have been entered display the following information:

• Total number of scores entered. • Total points for the student. • Total number of possible points • Class percentage, with 2 decimal place. • Letter grade using the 90, 80, 70, 60 grading scale. • If we believe the student has dropped. We will assume this is true if ALL of the entered scores are 0 (indicating that nothing was turned it). • If all of the scores were turned in or if the student is missing at least one score

Solutions

Expert Solution

'''Code to generate letter grade for a student and to display statistical details.'''

scores = [] #Store scores obtained
possible_scores=[] #Store possible scores
while(True): #Repeat till the user enter -1
  score = int(input("Enter score: ")) #user score 
  if score<-1: #Check non-negative number and display appropriate message
    print("Enter non-negative score")
    continue
  elif score == -1: #Check -1 and stop 
    break
  possible_score = int(input("Enter possible score: ")) #User possible score 
  scores.append(score) #Append all the score 
  possible_scores.append(possible_score) #Append all the possible score
percentage = (sum(scores)/sum(possible_scores))*100 #Percentage is the total score obtain divided by the maximun score * 100 

'''Letter grade using the 90, 80, 70, 60 grading scale . Check the grade .
percentage  Grade
100-90      A
90-80       B
80-70       C
70-60       D
60-0        F(Fail)'''
if percentage > 90:
  grade = 'A'
elif percentage > 80:
  grade ='B'
elif percentage >70:
  grade = 'C'
elif percentage > 60:
  grade = 'D'
else:
  grade = 'F'
  
'''Display the statistical details'''
print("Total number of scores entered:", len(scores))#Total number of scores entered
print("Total points for the student: ",sum(scores)) #Total points for the student
print("Total number of possible points: ",sum(possible_scores)) #Total possible points 
print("Percentage:{:.2f}".format( percentage)) #Percentage obtained
print("Student Grade : ", grade) #Grade received

'''Check if all the scores are zero then the student dropped.'''
if all(v == 0 for v in scores):
  print("Student has dropped")

Summary:

Calculate the letter grade and to dislplay the statistical details based on the scores provided

Input: Student scores and possible scores

Step1: Get input from the user till the score is -1. 1) Check if the score is not negative ; If is negative display error message 2) Check if the score is -1 ; If -1 stop user input 3) Append the score to the list of scores and possible scores.

Step 2: Find total of scores and possible scores usinf sum() and total number of scores using len() . Calculate percentage : Percentage is given by the total sum of marks obtained divided by total possible mark and the ans multiplied by 100.

percentage = (Total Sum of Scores obtained/Total Marks Possible)*100

Step 3: Letter grade using the 90, 80, 70, 60 grading scale . Check the grade using if- elif statement .

Percentage Grade

100-90 A

90-80 B

80-70 C

70-60 D

60-0 F(Fail)

Step 4: If all the scores in the score obtained are zero then "The Student has dropped". all() checks all the values if any one is False if return False.


Related Solutions

Write a C++ program named, myGrade.cpp, that calculates a letter grade for a student of this...
Write a C++ program named, myGrade.cpp, that calculates a letter grade for a student of this course (CSC100 online) based on three user inputs. This program should begin by printing the title of the application (program) and a brief description of what it does. (Note: this is NOT the same as the program prolog: a prolog is much more detailed, has required elements, and is intended for other programmers reading the cpp file. The title and description displayed by the...
Write a program that translates a letter grade into a number grade. Letter grades are A,...
Write a program that translates a letter grade into a number grade. Letter grades are A, B, C, D, and F, possibly followed by + or -. Their numeric values are 4, 3, 2, 1 and 0. There is no F+ or F-. A “+” increases the numeric value by 0.3, a “–“ decreases it by 0.3. However, an A+ has value 4.0.4 pts Enter a Letter grade: B- The numeric value is 2.7 Your code with comments A screenshot...
write a program that will display student grade if scores is greater than or equal to...
write a program that will display student grade if scores is greater than or equal to 70 to display A or else if score is less than or equal to 70 and greater than or equal to 60 display B if scores is less than 60 or greater than 50 display C else display fail.
Write a C program that calculates a student grade in the C Programming Class. Ask the...
Write a C program that calculates a student grade in the C Programming Class. Ask the user to enter the grades for each one of the assignments completed in class: Quiz #1 - 25 points Quiz #2 - 50 points Quiz #3 - 30 points Project #1 - 100 points Project #2 - 100 points Final Test - 100 points The total of the quizzes count for a 30% of the total grade, the total of the projects counts for...
Program 5A: Determine which student has the highest grade Write a Java program that determines which...
Program 5A: Determine which student has the highest grade Write a Java program that determines which student has the highest grade. You will ask the user to enter the number of students. Then you will ask for each student and their grade. You will output the name and grade of the student with the highest grade. You will NOT use an array for this assignment. Call your class Program5A, so your filename will be Program5A.java. It is essential for grading...
Java Ask the user to input a letter grade in either upper or lower case. You...
Java Ask the user to input a letter grade in either upper or lower case. You are to output a message depending on the grade. When the input is A or a, output the word "Excellent!" When the input is B or b, output "Very Good" When the input is C or c, output "Satisfactory" For any other input you must output the word "Fail".
write a Java program Write a program to assign a letter grade according to the following...
write a Java program Write a program to assign a letter grade according to the following scheme: A: total score >= 90 B: 80 <= total score < 90 C: 70 <= total score < 80 D: 60 <= total score < 70 F: total score < 60 Output - the student's total score (float, 2 decimals) and letter grade Testing - test your program with the following input data: test1 = 95; test2 = 80; final = 90; assignments...
1. ​ a)​Write a Matlab program to define student grade program and student number with if-else...
1. ​ a)​Write a Matlab program to define student grade program and student number with if-else statement logic​​​​​​​​​ b)​Write a Matlab program for sensor selection of temperature, pressure, flow sensor with if-else statement logic​​​​​​​​​ ​ 2.​Assume there are four letters from an information source with probabilities as A1 0.5 A2 0.3 A3 0.1 A4 0.1 Generate the tag and find the corresponding gaps and binary values for each stage and the sequence of the symbols which are coded are a1a3a2a4a1.​​​...
In C++ Write a program to store exam scores into a file. The program will ask...
In C++ Write a program to store exam scores into a file. The program will ask the user how many exam scores to enter. Then it will ask the user for each exam score and store them in a file called scores.dat The file output should have the following format: Exam 1: 97 Exam 2: 85
Write a c++ program that given a set of letter grade/credit hour combiniation, determines the grade...
Write a c++ program that given a set of letter grade/credit hour combiniation, determines the grade point average (GPA) Each A is worth 4 points. Each B is worth 3 points. Each C is worth 2 points. Each D is worth 1 point, and Each F is worth 0 points. The total quality points earned is the sum of the product of letter grade points and associated course credit hours. The GPA is the quotient of the quality points divided...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT