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
54 points!!! Cyber security
Veseljchak [2.6K]

Answer:

a

Explanation:

3 0
3 years ago
Suppose we eliminate tcp and instead rely exclusively on udp as our only transport layer protocol. ⢠how does this impact opera
evablogger [386]
TCP is a reliable protocol. Verification of the data (to an extent) is performed. UDP is an unreliable protocol. It's a "fire and forget" protocol. Since the verification ( packet counts, checksums ) isn't being done, the application[s] have to do it.
8 0
3 years ago
In which situations would it be most helpful to filter a form? Check all that apply.
Paladinen [302]

Answer: hey did you find the answer? Do you mind telling me it?

Explanation:

8 0
3 years ago
With a(n) ____ you can arrive at a scene, acquire the data you need, and return to the lab as quickly as possible.
valkas [14]

Answer:

Your answer is initial-response field kit

Explanation:

7 0
3 years ago
Where is the BIOS chip located?
masya89 [10]

Answer:

on the motherboard inside the computer

6 0
4 years ago
Read 2 more answers
Other questions:
  • What is the purpose of the overload keyword in the ip nat inside source list 1 pool nat_pool overload command?
    8·1 answer
  • Which of these forms of multimedia would most likely contain both music and text:
    14·1 answer
  • A computer lab has two printers. Printer I handles 40% of all the jobs. Its printing time is Exponential with the mean of 2 minu
    8·1 answer
  • How is a recession determined?
    10·1 answer
  • Biomimicry is the term used when engineers are inspired by objects found in nature? Group of answer choices True False
    10·1 answer
  • Thank you very much for your email. ...... was very interesting​
    15·1 answer
  • Why was the Internet first developed? Use details and information to explain your answer.
    6·1 answer
  • Write a formula that would return a TRUE result if the sum of the first five numbers in a column of data are negative
    7·1 answer
  • How many total bits are required for a direct mapped cache with 16 KB of data and 4 word blocks Assuming a 32 bit address
    12·1 answer
  • Help101111 avatar can we be friend's please? My name is Keegan. what is yours?
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!