Answer to Question #282593 in Python for jeennne

Question #282593

I try to fix this code many times but I don't know how to get the average of first quarter, second quarter, third quarter and fourth quarter of each students I hope I can get a help with this.

here is the code.

  #set student grades

  def studGrades(self,first,second,third,fourth):

    self.stQ.append(first)

    self.ndQ.append(second)

    self.rdQ.append(third)

    self.thQ.append(fourth)

    print("Student Grade 1st Quarter: ", first)

    print("Student Grade 2nd Quarter: ", second)

    print("Student Grade 3rd Quarter: ", third)

    print("Student Grade 4th Quarter: ", fourth)

  #average of 1st,2nd,3rd,4th

  def Average(self):

    for i in self.stQ,self.ndQ,self.rdQ,self.thQ:

      sums = self.stQ[i] + self.ndQ[i] + self.rdQ[i] + self.thQ[i]

      avg = sums / 4

      print(avg)


1
Expert's answer
2021-12-27T08:41:33-0500
m=('January','February','March','April','May','June','July','August'
,'September','October','November','December')
print("Months:")
for i in m:
    print(i)
print()
print("The four quarters are:")
print()
print("First Quarter :")
for i in m[:3]:
    print(i)
print()
print("Second Quarter :")
for j in m[3:6]:
    print(j)
print()
print("Third Quarter :")
for k in m[6:9]:
    print(k)
print()
print("Fourth Quarter :")
for l in m[9:12]:
    print(l)

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS