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
Orifice tubes are A. coded in American models only. B. coded by number for easy identification. C. similarly but not exactly siz
timurjin [86]
I'd go for (C) similarly but not exactly sized

Basically, to explain an orifice tube in Layman’s context, it is a car’s air conditioning system and is the exact place where the cold happens. Not all orifice tubes are standard sized and this means that different model vehicles use different sizes. These tubes are often color-coded for easy identification.






8 0
2 years ago
What are the tasks of a doc file
geniusboy [140]

Answer:

computer file is a computer resource for recording data discretely in a computer storage device. Just as words can be written to paper, so can information be written to a computer file. Files can be edited and transferred through the internet on that particular computer system.

6 0
3 years ago
Does anyone know the code for codeHS 5.4.7 teenagers?
Over [174]

Answer:

function start(){

var age = readInt("Age: ");

if(age == 15){

println("Yes, you are a teenager.");

}else{

println("No, you are not a teenager.");

}

}

Explanation:

6 0
2 years ago
Supplemental security software (such as anti-virus [anti-malware]) is: Generally considered essential for all desktops and lapto
k0ka [10]

Answer:

Explanation:

With an anti-virus, we can search, detect, and delete malware like spyware, worms, Trojans, rootkits, pseudoviruses, etc.

An anti-virus can detect virus with several methods like:

  • Digital signature
  • Heuristic detection
  • Behavior detection
  • Sandbox detection

Is necessary for personal laptops and desktops, even in companies hardware.

7 0
3 years ago
In preparing a works cited list, you should
sergeinik [125]
In preparing a works cited list, you should mlways follow MLA style. MLA style is the proper way to cite references<span> </span>
7 0
2 years ago
Other questions:
  • What operating system was most commonly used by early personal computers? Apple Mac MS-DOS Windows
    6·2 answers
  • Hub is used in Twisted pair Ethernet. True/False
    6·1 answer
  • Using the expected format, of putting key information where the reader can’t find it, is an example of?
    8·2 answers
  • Which group of commands all appear on the Standard toolbar?
    9·2 answers
  • How do governments correct for negative externalities?
    5·1 answer
  • All states that have altered judicial selection techniques in recent years have adopted some form of:
    5·1 answer
  • Important tools used in the _____ phase of the DMAIC process include a project charter, a description of customer requirements,
    10·1 answer
  • 14. In cell B14, create a formula without using a function that adds 1 to the value in cell B12 and then multiplies the result b
    9·1 answer
  • Java code?????
    12·1 answer
  • PLEASE HELP
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!