Using binary search approach, write a python function named update_record, which takes the following inputs: 1: students_records – Nested List of Tuples. Each tuple of the list represents student's data. 2: ID – An ID of a student whose data has to be updated 3: record_title – type of data that has to be updated 4: data – A new data that should replace record_title data and update the record of students' data associated to specific ID. If ID is given as the data to be updated, then return a message that ID cannot be updated. If ID is not found in students_records, then return a message that Record not found. NOTE: The type of record_title input can be "ID", "Email", "Mid1" or "Mid2". Please use the same spelling for these types in your code, because the same have been used in test cases. Test cases are attached below: student_records = '[("aa02822", "ea02822", 80, 65),("ea02822", "ea02822@st.habib.edu.pk", 80, 65),("fa08877", "fa08877@st.habib.edu.pk", 66, 67),("gh04588", "gh04588@st.habib.edu.pk", 33, 50)]' >>> update_record(students_records, "aa02822", "ID", "aa02456") ID cannot be updated >>> update_record(students_records, "aa02822", "Email", "aa02822@st.habib.edu.pk") [("aa02822", "aa02822@st.habib.edu.pk", 80, 65), ("ea02822", "ea02822@st.habib.edu.pk", 80, 65), ("fa08877", "fa08877@st.habib.edu.pk", 66, 67), ("gh04588", "gh04588@st.habib.edu.pk", 33, 50)] >>> update_record(students_records, 'f08877', "Mid2", 50) Record not found

COMPREHENSIVE MICROSOFT OFFICE 365 EXCE
1st Edition
ISBN:9780357392676
Author:FREUND, Steven
Publisher:FREUND, Steven
Chapter6: Creating, Sorting, And Querying A Table
Section: Chapter Questions
Problem 10EYK
icon
Related questions
Question

Using binary search approach, write a python function named update_record, which takes the following inputs:

1: students_records – Nested List of Tuples. Each tuple of the list represents student's data.

2: ID – An ID of a student whose data has to be updated

3: record_title – type of data that has to be updated

4: data – A new data that should replace record_title data and update the record of students' data associated to specific ID.

If ID is given as the data to be updated, then return a message that ID cannot be updated.

If ID is not found in students_records, then return a message that Record not found.

NOTE: The type of record_title input can be "ID", "Email", "Mid1" or "Mid2". Please use the same spelling for these types in your code, because the same have been used in test cases.

Test cases are attached below:

student_records = '[("aa02822", "ea02822", 80, 65),("ea02822", "ea02822@st.habib.edu.pk", 80, 65),("fa08877", "fa08877@st.habib.edu.pk", 66, 67),("gh04588", "gh04588@st.habib.edu.pk", 33, 50)]'

>>> update_record(students_records, "aa02822", "ID", "aa02456")

ID cannot be updated

>>> update_record(students_records, "aa02822", "Email", "aa02822@st.habib.edu.pk")

[("aa02822", "aa02822@st.habib.edu.pk", 80, 65), ("ea02822", "ea02822@st.habib.edu.pk", 80, 65), ("fa08877", "fa08877@st.habib.edu.pk", 66, 67), ("gh04588", "gh04588@st.habib.edu.pk", 33, 50)]

>>> update_record(students_records, 'f08877', "Mid2", 50)

Record not found

Expert Solution
steps

Step by step

Solved in 2 steps

Blurred answer
Knowledge Booster
Lists
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
COMPREHENSIVE MICROSOFT OFFICE 365 EXCE
COMPREHENSIVE MICROSOFT OFFICE 365 EXCE
Computer Science
ISBN:
9780357392676
Author:
FREUND, Steven
Publisher:
CENGAGE L