Menu

Iteration Lists Tuples Function Name Contains Parameters Alist List Talue Int Float Str Re Q43872005

using python
Iteration, Lists, and Tuples Function name: contains Parameters: a_list (list), Talue (int/float/str) Return Type: tuple DescIteration, Lists, and Tuples Function name: contains Parameters: a_list (list), Talue (int/float/str) Return Type: tuple Description: This function should iterate through a list using a for loop and return a boolean indicating if the value is within a list and also return the number of iterations necessary to find the element. Your loop must not execute more iterations than necessary, and you cannot use the in operator. Further you should iterate through a_list sequentially and should not manipulate the order or values of the list object. The boolean and number of iterations should be returned as a tuple. Test Cases: >>> contains ([1, 2, “3”, 4.5), 3) (False, 4) >>> contains ([1, 2, “3”, 4.5], 4.5) (True, 4) Show transcribed image text Iteration, Lists, and Tuples Function name: contains Parameters: a_list (list), Talue (int/float/str) Return Type: tuple Description: This function should iterate through a list using a for loop and return a boolean indicating if the value is within a list and also return the number of iterations necessary to find the element. Your loop must not execute more iterations than necessary, and you cannot use the in operator. Further you should iterate through a_list sequentially and should not manipulate the order or values of the list object. The boolean and number of iterations should be returned as a tuple. Test Cases: >>> contains ([1, 2, “3”, 4.5), 3) (False, 4) >>> contains ([1, 2, “3”, 4.5], 4.5) (True, 4)

Expert Answer


Answer to Iteration, Lists, and Tuples Function name: contains Parameters: a_list (list), Talue (int/float/str) Return Type: tuple…

OR