1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
velikii [3]
3 years ago
13

Create a funtion makeStudent(studentlist) where studentlist is your list of Student namedtuples The function should do the follo

wing: Take user input for each of the fields of the namedtuple Create a Student namedtuple using the input Add the Student to studentlist
Computers and Technology
1 answer:
seropon [69]3 years ago
4 0

Answer:

def makeStudent(student_list):

   name = input()

   major = input()

   year = int(input())

   hhh = int(input())

   gpa = float(input())

   newstu = Student(name,major,year,hhh,gpa)

   student_list.append(newstu)

def setGPA(student,val):

   student = student._replace(gpa= val)

   return student

def setMajor(student,val):

   student = student._replace(major = val)

   return student

def setYear(student,val):

   student = student._replace(year = val)

   return student

def averageGPA(student_list):

   sum = 0

   for i in range(len(student_list)):

       sum = sum + student_list[i].gpa

   avg = sum/len(student_list)

   return avg

def getTopStudentGPA(student_list):

   max = -1000

   for i in range(len(student_list)):

       if student_list[i].gpa > max:

           max = student_list[i].gpa

   return max

Student = namedtuple('Student', ['name', 'major', 'year', 'id', 'gpa'])

stu1 = Student('Kenneth', 'Computer Science', 6, 987654321, 3.8)

stu2 = Student('Maegan', 'Neuroscience', 4, 123456789, 3.4)

namedlist = []

print (namedlist)

namedlist.append(stu1)

namedlist.append(stu2)

print(namedlist)

makeStudent(namedlist)

makeStudent(namedlist)

makeStudent(namedlist)

print(namedlist)

print(namedlist[1])

print(namedlist[3])

Explanation:

  • Create a function to take in in the information of a new student.
  • Create functions for setting GPA, a major subject and year.
  • Calculate average GPA by dividing the total GPA of student with the length of student list.
  • Get top student by checking the student having a maximum GPA .
You might be interested in
Which type of front usually brings thunderclouds and storms
IrinaVladis [17]
Your anwser will be d
5 0
3 years ago
Read 2 more answers
Choose the answer that best explains why Morse's invention of the telegraph changed media forever.
Alex73 [517]

Just had this question, the correct answer is

It was the first form of media that did not require people to physically transport the information.

7 0
4 years ago
Read 2 more answers
Which property of a DBMS lets you change the database structure without requiring you to change the programs that access the dat
Gala2k [10]

Answer:

"Integrity constraints " is the correct answer.

Explanation:

  • A successful DBMS offers integrity constraints, which have been an option that allows you to modify the database layout without modifying the applications accessing the repository.
  • A principle or requirement which the data in something like a database should therefore obey.

So that the above is the correct choice.

8 0
4 years ago
does someone know of a website where I can find free essays or assignments already answered (right or wrong, ain't matter), kind
nalin [4]

Answer:

Your

Explanation:

Taking answers from online is plagiarism. If you get caught, you could get in trouble. If you don't know the subject well enough that doesn't matter because apparently you don't care your grade.

5 0
3 years ago
What sorts of items can be
Bumek [7]

Answer:

A router connects multiple computers to the Internet through a single connection. The router manages the flow of data, delivering the right information to each computer on the network. Routers may also be used to connect multiple networks. A managed router is a router that is owned and managed by a third-party.

6 0
4 years ago
Other questions:
  • The most widely used presentation software program is Microsoft PowerPoint. You can produce a professional and memorable present
    15·1 answer
  • Changing the color of my avatar using a computer program is ok since it doesn't impact anyone else
    12·1 answer
  • which of the following is involved in ordering an outline. A.grouping B.merging C.organizing D.arranging
    10·1 answer
  • According to many experts how often should files be backed up
    12·2 answers
  • You have three users who travel to four branch offices often and need to log on to the RODCs at these offices. The branch office
    12·1 answer
  • By
    7·1 answer
  • Which of the following statement is False? 1 point Context free language is the subset of context sensitive language Regular lan
    5·1 answer
  • When people receive benefits just because they belong to a particular identity group, this is called
    14·1 answer
  • Becuase privacy is personal customers, where should your data privacy efforts align?
    13·1 answer
  • alle Mbawah: Attempt 1 How does a bystander become an advocate? By harassing the bully until he or she stops the harmful activit
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!