# 11.13. Write Code Questions¶

1. Write a function called `tup_creation` that takes in two integer parameter, `start` and `end`, and returns a tuple with all the values between `start` (inclusive) and `end` (non-inclusive). For example, `tup_creation(-8,3)` would return `(-8, -7, -6, -5, -4, -3, -2, -1, 0, 1, 2)` and `tup_creation(10,3)` would return `(10, 9, 8, 7, 6, 5, 4)`.

Write a function called `tup_creation` that takes in two integer parameter, `start` and `end`, and returns a tuple with all the values between `start` (inclusive) and `end` (non-inclusive). For example, `tup_creation(-8,3)` would return `(-8, -7, -6, -5, -4, -3, -2, -1, 0, 1, 2)` and `tup_creation(10,3)` would return `(10, 9, 8, 7, 6, 5, 4)`.

2. 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]`.

3. Write a function called `find_majors` that takes in a dictionary as a parameter, `majors`, that has a major code as the key and the name of a major as the value. Return a list of tuples of size two, in which the first element of the tuple is the major code and the second element of the tuple is the name of the major. For example, `find_major({3084: 'Computer Science', 3025: 'Electrical Engineering', 3020: 'Computer Engineering', 3027: 'Cybersecurity', 3068: 'Biometric Systems Engineering'})` would return `[(3084, 'Computer Science'), (3025, 'Electrical Engineering'), (3020, 'Computer Engineering'), (3027, 'Cybersecurity'), (3068, 'Biometric Systems Engineering')]`.

Write a function called `find_majors` that takes in a dictionary as a parameter, `majors`, that has a major code as the key and the name of a major as the value. Return a list of tuples of size two, in which the first element of the tuple is the major code and the second element of the tuple is the name of the major. For example, `find_major({3084: 'Computer Science', 3025: 'Electrical Engineering', 3020: 'Computer Engineering', 3027: 'Cybersecurity', 3068: 'Biometric Systems Engineering'})` would return `[(3084, 'Computer Science'), (3025, 'Electrical Engineering'), (3020, 'Computer Engineering'), (3027, 'Cybersecurity'), (3068, 'Biometric Systems Engineering')]`.

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")`.

5. Write a function called `dict_transform` that takes in one dictionary parameter, `dict`, which returns a tuple of tuples. The inner tuple should have the first element as the key of the `dict` and the second element should have the value of the `dict`. Do not use the `keys()` or `values()` methods. For example, `dict_transform({'Rattata': 19, 'Machop': 66, 'Seel': 86, 'Volbeat': 86, 'Solrock': 126})` should return `(('Rattata', 19), ('Machop', 66), ('Seel', 86), ('Volbeat', 86), ('Solrock', 126))`.

Write a function called `dict_transform` that takes in one dictionary parameter, `dict`, which returns a tuple of tuples. The inner tuple should have the first element as the key of the `dict` and the second element should have the value of the `dict`. Do not use the `keys()` or `values()` methods. For example, `dict_transform({'Rattata': 19, 'Machop': 66, 'Seel': 86, 'Volbeat': 86, 'Solrock': 126})` should return `(('Rattata', 19), ('Machop', 66), ('Seel', 86), ('Volbeat', 86), ('Solrock', 126))`.

6. 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,)`.

7. Write the function `mod_tuples` which takes a list of tuples, `tup_list` and returns a copy where the last element in each tuple is modified to be 100. For example, `mod_tuples([(3,4), (20, -3, 2)])` returns [(3,100), (20, -3, 100)].

Write the function `mod_tuples` which takes a list of tuples, `tup_list` and returns a copy where the last element in each tuple is modified to be 100. For example, `mod_tuples([(3,4), (20, -3, 2)])` returns [(3,100), (20, -3, 100)].

8. 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')`.

9. Write a function `list_link` that accepts two lists, `lst1` and `lst2` and returns a dictionary with the first list as the key and the second list as the value. For example, `list_link(['what', 'do', 'you', 'do'], [1,2,3,4])` should return `{'what': 1, 'do': 4, 'you': 3}`.

Write a function `list_link` that accepts two lists, `lst1` and `lst2` and returns a dictionary with the first list as the key and the second list as the value. For example, `list_link(['what', 'do', 'you', 'do'], [1,2,3,4])` should return `{'what': 1, 'do': 4, 'you': 3}`.

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')`.