Answered step by step
Verified Expert Solution
Question
1 Approved Answer
' ' ' Please write code that can be used below my current output, that will take the current overall score that is outputted at
Please write code that can be used below my current output, that will take the current overall score that is outputted at the end and then write a function, to tell the user the specific score that they need on the final exam with the final exam grade weight taken into account to achieve each possible overall letter grade in the course A D def getweightsnumtests: testweights for i in range numtests : weight floatinputfPercentage weight of Test i: testweights.appendweight return testweights def getscoresnumtests: testscores for i in range numtests : score floatinputfTest i score: testscores.appendscore return testscores def calculatecurrentscoretestscores, testweights, homeworkweight, homeworkscore, programsweight, programsscore: currentscore sumscore weight for score, weight in ziptestscores, testweights if homeworkweight : currentscore homeworkscore homeworkweight if programsweight : currentscore programsscore programsweight return currentscore def main: numtests intinputHow many tests were given? testweights getweightsnumtests finalweight floatinputPercentage weight of Final: homeworkweight floatinputPercentage weight of Homework for no hw: programsweight floatinputPercentage weight of Programs for no pgms: totalweight sumtestweights finalweight homeworkweight programsweight if totalweight : printThe total weight of all components must be return testscores getscoresnumtests homeworkscore floatinputHomework Average: if homeworkweight else programsscore floatinputProgram Average: if programsweight else currentscore calculatecurrentscoretestscores, testweights, homeworkweight, homeworkscore, programsweight, programsscore printfYour current numeric score in the class without the final is currentscore:f if currentscore : currentgrade A elif currentscore : currentgrade B elif currentscore : currentgrade C elif currentscore : currentgrade D else: currentgrade E printfWithout the final final you would get a currentgrade in the class"
Please write code that can be used below my current output, that will take the current overall score that is outputted at the end and then write a function,
to tell the user the specific score that they need on the final exam with the final exam grade weight taken into account
to achieve each possible overall letter grade in the course A D
def getweightsnumtests:
testweights
for i in range numtests :
weight floatinputfPercentage weight of Test i:
testweights.appendweight
return testweights
def getscoresnumtests:
testscores
for i in range numtests :
score floatinputfTest i score:
testscores.appendscore
return testscores
def calculatecurrentscoretestscores, testweights, homeworkweight, homeworkscore, programsweight, programsscore:
currentscore sumscore weight for score, weight in ziptestscores, testweights
if homeworkweight :
currentscore homeworkscore homeworkweight
if programsweight :
currentscore programsscore programsweight
return currentscore
def main:
numtests intinputHow many tests were given?
testweights getweightsnumtests
finalweight floatinputPercentage weight of Final:
homeworkweight floatinputPercentage weight of Homework for no hw:
programsweight floatinputPercentage weight of Programs for no pgms:
totalweight sumtestweights finalweight homeworkweight programsweight
if totalweight :
printThe total weight of all components must be
return
testscores getscoresnumtests
homeworkscore floatinputHomework Average: if homeworkweight else
programsscore floatinputProgram Average: if programsweight else
currentscore calculatecurrentscoretestscores, testweights, homeworkweight, homeworkscore, programsweight, programsscore
printfYour current numeric score in the class without the final is currentscore:f
if currentscore :
currentgrade A
elif currentscore :
currentgrade B
elif currentscore :
currentgrade C
elif currentscore :
currentgrade D
else:
currentgrade E
printfWithout the final final you would get a currentgrade in the class"
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access with AI-Powered Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started