Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Moving Objects Databases

Authors: Ralf Hartmut Güting, Markus Schneider

1st Edition

0120887991, 978-0120887996

More Books

Students also viewed these Databases questions

Question

What is the basis for Security Concerns in Cloud Computing?

Answered: 1 week ago

Question

Describe the three main Cloud Computing Environments.

Answered: 1 week ago