Question: Some Preliminaries In Python, a tuple is a collection similar to a list in that it is an ordered collection of items. An important difference,

 Some Preliminaries In Python, a tuple is a collection similar toa list in that it is an ordered collection of items. An

Some Preliminaries In Python, a tuple is a collection similar to a list in that it is an ordered collection of items. An important difference, however, is that a tuple is immutable - once created, a tuple cannot be changed. Also, tuples are denoted using parentheses instead of square brackets. As with lists, elements of a tuple are accessed using indexing notation. For example, given the tuple subjects('physics', 'chemistry', 'biology' ), we could ac- cess the elements of the tuple using subject s [ 0 ] , subject s [ 1 ] and sub jects [ 2 ] . The Function to Write In this part of the assignment, you will write a function findemployee (), which takes three arguments, in this order: employees: A list of lists, in which each sub-list contains information about one particular employee Inside each sub-list we always find five tuples, wherein each tuple has two values: the first value is a field name, and the second value is the value of that field. The fields available are listed below. Note that although the five tuples will always exist, their order inside the sub-list may differ from employee to employee. o 'Name': this string is the employee's name o 'Age': this integer is the employee's age o 'Salary' : this integer is the employee's salary o Experience': this integer is the years of experience the employee has o 'Level': this integer is the employee's rank An example employees list containing the information about two employees is given below: employees[ [ ('Name 'Tom'), 'Age, 21), Salary', 1000), Experience', 1), Level', 1)], 'Experience, 2), 'Age', 22), 'Name', Sam'), 'Salary', 2500), ('Level', 3)1 search-field: this is the particular field you are looking for search value: this is the desired value of a field you are looking for The function searches the employees list and returns a list of employee names whose search.field's value is equal to search-value. For example, if search-field- , Level, and search-value 2, the function would return a list of employee names whose Level is exactly 2

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!