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

Np Ms Office 365/Excel 2016 I Ntermed
1st Edition
ISBN:9781337508841
Author:Carey
Publisher:Carey
Chapter3: Performing Calculations With Formulas And Functions
Section: Chapter Questions
Problem 3.9CP
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
Np Ms Office 365/Excel 2016 I Ntermed
Np Ms Office 365/Excel 2016 I Ntermed
Computer Science
ISBN:
9781337508841
Author:
Carey
Publisher:
Cengage