Created
July 29, 2017 16:52
-
-
Save santiagobasulto/43a9ea1b822ca7ddbc60fd9e5d0f058f to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def range(x, y=None): | |
| results = [] | |
| if y is None: | |
| y = x | |
| x = 0 | |
| while x < y: | |
| results.append(x) | |
| x += 1 | |
| return results | |
| # Tests ;) | |
| assert range(5) == [0, 1, 2, 3, 4] | |
| assert range(2, 10) == [2, 3, 4, 5, 6, 7, 8, 9] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment