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