python - Creating a gradebook application -


can 1 tell me wrong coding? have to

  1. display students , grades on console. list should include header specifies class name, section , grading weights.
  2. calculate grades students , display information along students letter grade on console (please note student grades weighted!).
  3. calculate grade average class , letter grade class

code:

f=open("greades.txt", "r") sum=0 line in f:     #split data rows     items = line.split()     sum=0     #getting data in rows      in range(1,9):         sum+=int(items[i])     print(items[0],"\ttotal:",sum,"\taverage:",sum/9)       def average(mygreades):     """ function calculate average of input of list have """     if(len(mygreades)==0):         return 0.0     mygreades=[1]     sum=0     item in mygreades:         sum+=item      avg = sum/len(mygreades)     return avg  def converter(mygreades):     """ function convert input list of strings number list """     numberlist = []     item in mygreades:         if(item.isnumeric()):             numberlist.append(eval(item))     return numberlist   main()  

you have indentation error. consider following lines of code:

def average(mygreades): """ function calculate average of input of list have """ if(len(mygreades)==0): 

notice how doc string , if statement lined under def. incorrect indentation -- body of function must indented. it's unusual have function defined inside loop you're doing here.


Comments

Popular posts from this blog

SPSS keyboard combination alters encoding -

Add new record to the table by click on the button in Microsoft Access -

CSS3 Transition to highlight new elements created in JQuery -