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]
2 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]2 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
I NEED A BIG BRAIN BOYO TO HELP ME
dlinn [17]
Yoooo whattt?? I don’t get this but idek
7 0
3 years ago
ANSWER QUICKLIY
lidiya [134]

Answer:

Explanation:

Allow you to view the document in different ways. Sorry if I am wrong. I am dumb

God bless, stay safe, and good luck! :)

4 0
3 years ago
Read 2 more answers
How many bits are required to store the text of the number 150 in ascii?
kaheart [24]
The correct answer of the given question above would be 24 BITS. The number of bits that are required to store the text of the number 150 in ASCII would be 24 bits. ASCII means American Standard <span>Code for Information Interchange. Hope this answer helps. </span>
7 0
3 years ago
Read 2 more answers
Write a program using python 3 that asks the user how many integers they would like to enter. You can assume that this initial i
mixer [17]

I've included my code in the picture below. Best of luck.

8 0
2 years ago
What does the Communications Decency Act of 1996 provide?
Softa [21]

Answer:

a

Explanation:

its the correct becayse

3 0
2 years ago
Other questions:
  • Explaim Why the shape of a cell is hexagonal
    15·1 answer
  • How to write "There are four parking spots on campus that may be used only by Nobel Prize winning faculty." this sentence correc
    12·1 answer
  • What is the maximum number of communication paths for a team of twenty people?
    5·1 answer
  • Windows uses a memory-management technique known as ________ to monitor which applications you use most frequently and then prel
    8·1 answer
  • Complete a graphic organizer to explain the responsibilities of a borrower
    14·1 answer
  • A program is considered portable if it . . . can be rewritten in a different programming language without losing its meaning. ca
    13·1 answer
  • What are ip addresses? why are these important for forensic scientists?
    5·1 answer
  • Pick the correct characteristics that define the porous inkjet paper.
    6·1 answer
  • Where is 5G being used and how fast is it?​
    5·2 answers
  • A corporation is looking to receive approval from its shareholders. The corporation needs to communicate financial information a
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!