Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Write a Grade Calculator Companion App in Python (Python-as-a-Programing Languag

ID: 3720557 • Letter: W

Question

Write a Grade Calculator Companion App in Python (Python-as-a-Programing Language)

4. Instructor Companion App
M-courses, N-students/course
K-scores/student/course

5. Student Transcript Companion App
N-students, K-scores/student
N,K: command line arg
get input file
5,3
a) 67, 89, 34 // lastname firstname
51, 55, 57
90, 97, 12
88, 89, 81
67, 62, 68
determine letter grades / student
b) JSON file:
67, 89, 34, "LastName FirstName"
c) JSON file:
67, 89, 34, "LastName", "FirstName"

Make each program seperate.

Explanation / Answer

PROGRAM:-

'''
1. 1-student, 1-score
hard-code
ask user: interactive
display on screen

score = 53
Grade is F
'''

def getGrade(score):
if score > 90:
return 'A'
elif score > 80:
return 'B'
elif score > 70:
return 'C'
elif score > 60:
return 'D'
return 'F'

score = int(input("score = "))
print("Grade is " + getGrade(score))


'''
2. 1-student, K-scores
K: ask user, command line arg
get from an input file
K-scores:
get k - scores and average them and get a letter grade.
get the score from an input file and show the averaged grade.
CSV files: comma separated values
scores.txt:
'''

def getGrade(score):
if score > 90:
return 'A'
elif score > 80:
return 'B'
elif score > 70:
return 'C'
elif score > 60:
return 'D'
return 'F'

def getScore(file):
with open(file) as fp:
for line in fp:
line = line.rstrip()
scores = [int(score) for score in line.split(",")]
return sum(scores)/float(len(scores))

file = input("score.txt: ")
print("Grade is " + getGrade(getScore(file)))


'''
3. N-students, K-scores/student
N,K: command line arg
get input file
5,3
67, 89, 34
51, 55, 57
90, 97, 12
88, 89, 81
67, 62, 68
determine letter grades / for each student by averaging their grade
'''
def getGrade(score):
if score > 90:
return 'A'
elif score > 80:
return 'B'
elif score > 70:
return 'C'
elif score > 60:
return 'D'
return 'F'

def printGradeScore(file):
with open(file) as fp:
for line in fp:
line = line.rstrip()
scores = [int(score) for score in line.split(",")]
score = sum(scores)/float(len(scores))
print("Grade is " + getGrade(score))

file = input("score.txt: ")
printGradeScore(file)

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote