Skip to main content

Section 11.15 Write Code Questions Orig

Activity 11.15.1.

Write a function called check_third_element that takes in a list of tuples, lst_tups as a parameter. Tuples must have at least 3 items. Return a new list that contains the third element of each tuple. For example, check_third_element([(1,2.2,3.3),(-1,-2,-3),(0,0,0)]) would return [3.3, -3, 0].

Activity 11.15.2.

Create a function called check_third_element that takes in a list of tuples, lst_tups as a parameter. Tuples must have at least 3 items. Return a new list that contains the third element of each tuple. For example, check_third_element([(1,2.2,3.3),(-1,-2,-3),(0,0,0)]) would return [3.3, -3, 0].

Activity 11.15.3.

Write a function called interchange_values that takes in a tuple with two values as a parameter, t and returns a tuple which interchanges the values of t. For example, interchange_values(("LeBron", "James")) would return ("James", "LeBron").

Activity 11.15.4.

Create a function called interchange_values that takes in a tuple with two values as a parameter, t and returns a tuple which interchanges the values of t. For example, interchange_values(("LeBron", "James")) would return ("James", "LeBron").

Activity 11.15.5.

Write a function called my_data that takes in an integer, int_value as a parameter. Return tuple that contains one elements, the integer in the parameter. For example, my_data(99) would return (99,).

Activity 11.15.6.

Create a function called my_data that takes in an integer, int_value as a parameter. Return tuple that contains one elements, the integer in the parameter. For example, my_data(99) would return (99,).

Activity 11.15.7.

Write a function called info with the following required parameters: name, age, birth_year, year_in_college, and hometown. The function should return a tuple that contains all the passed information. For example, info('Troy', 24, 1996, 'Sophomore', 'Ann Arbor') should return ('Troy', 24, 1996, 'Sophomore', 'Ann Arbor').

Activity 11.15.8.

Create a function called info with the following required parameters: name, age, birth_year, year_in_college, and hometown. The function should return a tuple that contains all the passed information. For example, info('Troy', 24, 1996, 'Sophomore', 'Ann Arbor') should return ('Troy', 24, 1996, 'Sophomore', 'Ann Arbor').

Activity 11.15.9.

Write a function tuplize() that accepts two inputs and returns a tuple containing those inputs in order. For example, tuplize('Stephen', 'Curry') would return ('Stephen', 'Curry').

Activity 11.15.10.

Create a function tuplize() that accepts two inputs and returns a tuple containing those inputs in order. For example, tuplize('Stephen', 'Curry') would return ('Stephen', 'Curry').
You have attempted of activities on this page.