Question: Please Help!!!! python project I can not get right average calculation. also how I can type any key to add student, I want to use

Please Help!!!! python project

I can not get right average calculation. also how I can type any key to add student, I want to use only c or C to continue.........

# student class class Student: # capturing the student info def __init__(self, id, name, grade1, grade2, grade3, grade4): self.id=id self.name=name self.grades=[grade1, grade2, grade3, grade4] # calculates the average of grade def getAverage(self): return (self.grades[0]+self.grades[0]+self.grades[0]+self.grades[0])/4.0 # gives string representation of student object def __str__(self): return "Student: \tId: "+self.id+" \tname: "+self.name+" \tAverage: "+str(self.getAverage())+" "

def process(): # list stores list of student objects List=[] while True: # enter choice to continue or quit choice=input("Enter a for add student/ Enter c for calcilate grade: ") if choice=="c": break # take info of student and add to list name=input("Enter students name: ") id=input("Enter students id: ") grade1=int(input("Enter grade1: ")) grade2 = int(input("Enter grade2: ")) grade3= int(input("Enter grade3: ")) grade4 = int(input("Enter grade4: ")) student=Student(id, name, grade1, grade2, grade3, grade4) List.append(student) # iterate over student list and print them for std in List: print(std)

process()

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!