Ask your own question, for FREE!
Computer Science 19 Online
OpenStudy (anonymous):

I need a code that does this? I am using python.

OpenStudy (anonymous):

OpenStudy (rsmith6559):

Okay, what part's goofing you up?

OpenStudy (anonymous):

def main(): test1 = int(input('Enter test grade 1: ')) test2 = int(input('Enter test grade 2: ')) test3 = int(input('Enter test grade 3: ')) test4 = int(input('Enter test grade 4: ')) test5 = int(input('Enter test grade 5: ')) print(calc_average) print(determine_grade) return; def calcAverage(): grade / 5 return averageScore def determinGrade(score): if grade >= 90 and grade <= 100: return 'A' elif grade >= 80 and grade <= 89: return 'B' elif grade >= 70 and grade <= 79: return 'C' elif grade >= 60 and grade <= 69: return 'D' else: return 'F' main()

OpenStudy (anonymous):

This is what i have so far, i just cant figure out how to make it look like the 2nd pic lol

OpenStudy (rsmith6559):

The code that you've posted has a couple of issues: print(calc_average) print(determine_grade) These look like you wanted function calls. The syntax for calling a function is: functionName( arg1, arg2, argN ) If there are no arguments passed, you still need the parenthesis: functionName() The rest of the program is just formatted output, which isn't hard. You'd be better off setting each separate part of this as it's own function and then using the main() function to tie/glue the functions together. Larger programs will require this approach. From days of old, the 1960's, the main() function has been the point where a program starts executing. It's a required setup in C, C++, Java and other languages. Python can do it in an interesting way that allows the functions and classes of your program to be used like library code, but the program will still execute normally if it's called as a program: if( __name__ == "__main__" ): # execution start here if everything else is def's

OpenStudy (anonymous):

Ok so i edited it a little bit and this is what I have. How do i make it say Enter Grade and Enter name after each other so it looks the like the 2nd jpg i posted. Then how do i use that to put it into a graph? That is all I need help with i think i did most of it pretty well :)

OpenStudy (anonymous):

_list = [] def calc_average(total): return total / 5 #Determine the Grade Letter def determine_grade(grade): if grade >= 90 and grade <= 100: return 'A' elif grade >= 80 and grade <= 89: return 'B' elif grade >= 70 and grade <= 79: return 'C' elif grade >= 60 and grade <= 69: return 'D' else: return 'F' while True: grade = int(input('Enter grade: ')) _list.append(grade) avg = calc_average(sum(_list)) abc_grade = ' '.join([determine_grade(mark) for mark in _list]) if len(_list) > 4: break while True: name = int(input('Enter name: ')) _list.append(name) if len(_list) > 9: break #Print the Average and the Grade print('Average grade is: ', avg) print('Letter grades for entered grades are: ', abc_grade)

OpenStudy (rsmith6559):

If you're using Python v3 (which is the syntax of your print functions) the input function is the correct choice. If it's not working like you want, you may be working in Python v2. Obviously, this needs to be straightened out. The "graph" is actually all formatted print functions. Three of the four header and footer lines are just print( "constant string" ). The data lines just iterate through _list and output it formatted. And the final line just calculates the average, prints it and outputs the letter grade for the average.

Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!
Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!