Question: I need Help I cant get my code to produce any output. I CANNOT USE THE INPUT Function. I have to use sys.argv. this is

I need Help I cant get my code to produce any output. I CANNOT USE THE INPUT Function. I have to use sys.argv. this is what i have so far. i'm also posting the assignment. any help would be appreciated.

import sys g1=float(sys.argv[1]) g2=float(sys.argv[2]) g3=float(sys.argv[3]) g4=float(sys.argv[4]) g5=float(sys.argv[5]) try:

def calcavg(g1,g2,g3,g4,g5): average = (g1+g2+g3+g4+g5)/5 return average def getletter(score): if score >= 90: return 'A' elif score >= 80: return 'B' elif score >= 70: return 'C' else: return 'F' def printresults(score,avg): print('Average:',avg) print('Letter grade',score)

except ValueError: print('Error, all grades must be numeric.')

I need Help I cant get my code to produce any output.

Write a program that calls the following functions to produce the output shown below. calcavg(): takes five grades as parameters and returns the average. getletter(): take the average as a parameter and return the letter grade. You can use the following table to find the letter grades. printresults(): takes the average and letter grade as parameters, and prints the output as shown below. The program before calling the functions should verify the grades and make sure all the grades are numeric. If there are non- numeric grades, it should display the proper message to the user. Numeric Grade Letter Grade >=90 A >=80 B >=70 >=60 D

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!