Student Majors
A university's Office of Admission keeps track of student majors. Each student can have a single major. Below is an example of how their system stores students, majors, and how it manipulates them:
students = [("Allen Anderson", "Computer Science"),
("Edgar Einstein", "Engineering"),
("Farrah Finn", "Fine Arts")]
def add_new_student(students, name, major):
students.append((name, major))
def update_student(students, index, name, major):
students[index] = (name, major)
def find_students_by_name(students, name):
return [student for student in students if name in student[0]]
def get_all_majors(students):
return [student[1] for student in students]
What can be concluded from the code snippet above?
(Select all acceptable answers.)
Tags
- Python
- Lists
- Tuples
- New
- Public
- Easy
Information
Score Distribution
% of candidates
Score
Would you like to see our other questions?
We have 1000+ premium hand-crafted questions for 160+ job skills and 20+ coding languages. We prefer questions with small samples of actual work over academic problems or brain teasers.
On the blog
Since we're all biased and we use incorrect proxies, why not just outsource hiring to experts or recruitment agencies? After all, they've been screening people for many years, so they must know how to do it right?
Not really. I was surprised to discover that many experts...