Automated grading of homework assignments and tests
- fork this repository
- solve the task
- commit with proper message
Return an empty Tuple to the result.
Example 1:
Input:
Output: ()A Tuple of several elements is given. Return the first item.
Example 1:
Input: tuple1=(1,2,3,4,5)
Output: 1Example 2:
Input: tuple1=("x", 1, "y", 2, "z", 3)
Output: "x"Constraints:
- 1 <= length(tuple1) <= 10^5
tuples tuple1 and tuple2 are given. Add them (combine) and return.
Example 1:
Input: tuple1=(1, 2, 3, 4, 5) tuple2=(6, 7, 8, 9, 10)
Output: (1, 2, 3, 4, 5, 6, 7, 8, 9, 10)Example 2:
Input: tuple1=("x", 1) tuple2=("y", 2, "z", 3)
Output: ("x", 1, "y", 2, "z", 3)Constraints:
- 1 <= length(tuple1) <= 10^5
- 1 <= length(tuple2) <= 10^5
A tuple of several elements is given. Return the last item.
Example 1:
Input: tuple1=(1, 2, 3, 4, 5)
Output: 5Example 2:
Input: tuple1=(5,3,'a',1,2)
Output: 2Constraints:
- 1 <= length(tuple1) <= 10^5
A tuple of several elements is given. i Return the item in the index.
Example 1:
Input: tuple1=(1, 2, 3, 4, 5) i=1
Output: 2Example 2:
Input: tuple1=(5,3,'a',1,2) i=3
Output: 1Constraints:
- 1 <= length(tuple1) <= 10^5
- 0 <= i < length(tuple1)
A tuple of units and zeros with a length of five is given. Replace one with True.
Example 1:
Input: tuple1=(1, 0, 0, 0, 0)
Output: (True, 0, 0, 0, 0)Example 2:
Input: tuple1=(1, 0, 1, 1, 0)
Output: (True, 0, True, True, 0)Constraints:
- length(tuple1) == 5
A tuple of units and zeros with a length of five is given. Replace zero with False.
Example 1:
Input: tuple1=(1, 0, 0, 0, 0)
Output: (1, False, False, False, False)Example 2:
Input: tuple1=(1, 0, 1, 1, 0)
Output: (1, False, 1, 1, False)Constraints:
- length(tuple1) == 5
A tuple of ones and zeros, five in length, is given. replace one with True, replace zeros with False.
Example 1:
Input: tuple1=(1, 0, 0, 0, 0)
Output: (True, False, False, False, False)Example 2:
Input: tuple1=(1, 0, 1, 1, 0)
Output: (True, False, True, True, False)Constraints:
- length(tuple1) == 5
A tuple of several elements is given. True if all items are the same, otherwise return False.
Example 1:
Input: tuple1=(0, 0, 0, 0, 0)
Output: TrueExample 2:
Input: tuple1=('x', 'x', 'y', 'y', 'z')
Output: FalseConstraints:
- 1 <= length(tuple1) <= 10^5
A tuple of numbers consisting of several elements is given. Return the largest between the first and last elements.
Example 1:
Input: tuple1=(5, 32, 1, 4, 3)
Output: 5Example 2:
Input: tuple1=(12, 2, 5, 2, 7, 9, 1)
Output: 12Constraints:
- 1 <= length(tuple1) <= 10^5
- don't copy other solutions or any solution
- don't remove comments