Write Code QuestionsΒΆ
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]
.
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]
.
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")
.
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")
.
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,)
.
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,)
.
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')
.
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')
.
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')
.
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')
.