Search results
Results from the WOW.Com Content Network
For scores >= 90 and <= 100 you can write 90 <= scores <= 100. i don't know, if the score is a float or integer number.
Returning a letter grade given a grade-scale and a student's GPA. 2. python function calculate grades. 20.
calc_average - takes a list of grades as an argument and displays the average of the scores, along with a letter grade equivalent to that average. main - asks the user to enter five test scores and puts them as numbers into a list; showLetters – echo prints scores entered by the user with letter grade equivalents
The print() statement inside lettergrade() will only print out the grade, so change each print statement to `print('LETTER:' + value). In addition, the method lettergrade() will only print out one thing, so there needs to be a loop to call it multiple times, with multiple values:
First off, if your function is to take a grade as an integer and return a letter grade, why does it have a return type of double? After dealing with that, here is a hint: The grade could range from 0 to 100, so that is 101 cases to handle in your switch statement. So you could write out all 101 cases if you wanted.
def get_letter_grade_v1(grade_scale, gpa): for (key, data) in grade_scale.items(): if gpa <= data['high'] and gpa >= data['low']: return key. # When every check has failed: return 'D'. More updates: You have to give the data in the proper form. 3.47 is a very low grade: your scale is percentage, but you feed it a GPA.
[letter for letter, rnge in grades.items() if grade in rnge][0] This is a list comprehension, in which we iterate through each (key, value) tuple in the list returned by grades.items() and see if the submitted grade falls in the range of a given letter grade. Since there is no overlap in the ranges, this list will have one element.
To have it print the letter grade as a user enters a score you can do something like: #Calculate average def calc_average(total): return total / 5 #Grading scale def ...
Using the switch statement, write a program that converts a numerical grade into a letter grade: Enter numerical grade: 84 Letter grade: B Use the following grading scale: A = 90-100, B = 80-89,...
I'm working on a program for class that finds the average of 5 entered test scores then displays the letter grades relevant to each letter score. letter score is a 10 point system ( A = 90-100 B = ...