Skip to content

Commit

Permalink
return Iterable
Browse files Browse the repository at this point in the history
  • Loading branch information
oduvan committed Jan 11, 2020
1 parent 3351f7c commit 57c6afc
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
13 changes: 8 additions & 5 deletions editor/initial_code/python_3
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
def replace_first(items: list) -> list:
from typing import Iterable


def replace_first(items: list) -> Iterable:
# your code here
return items


if __name__ == '__main__':
print("Example:")
print(replace_first([1, 2, 3, 4]))
print(list(replace_first([1, 2, 3, 4])))

# These "asserts" are used for self-checking and not for an auto-testing
assert replace_first([1, 2, 3, 4]) == [2, 3, 4, 1]
assert replace_first([1]) == [1]
assert replace_first([]) == []
assert list(replace_first([1, 2, 3, 4])) == [2, 3, 4, 1]
assert list(replace_first([1])) == [1]
assert list(replace_first([])) == []
print("Coding complete? Click 'Check' to earn cool rewards!")
4 changes: 2 additions & 2 deletions info/task_description.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<!-- Describe task in general -->

<p>
In a given array the first element should become the last one. An empty array or array with only one element should stay the same.
In a given {% if interpreter.slug == "js-node" %}array{% else %}list{% endif %} the first element should become the last one. An empty {% if interpreter.slug == "js-node" %}array{% else %}list{% endif %} or {% if interpreter.slug == "js-node" %}array{% else %}list{% endif %} with only one element should stay the same.
</p>

<p style="text-align: center;">
Expand All @@ -13,7 +13,7 @@
</p>

<p>
<strong>Output: </strong> {% if interpreter.slug == "js-node" %}Array{% else %}List{% endif %}.
<strong>Output: </strong> {% if interpreter.slug == "js-node" %}Array{% else %}Iterable{% endif %}.
</p>


Expand Down

0 comments on commit 57c6afc

Please sign in to comment.