Skip to content

Instantly share code, notes, and snippets.

@santiagobasulto
Created July 29, 2017 16:52
Show Gist options
  • Save santiagobasulto/43a9ea1b822ca7ddbc60fd9e5d0f058f to your computer and use it in GitHub Desktop.
Save santiagobasulto/43a9ea1b822ca7ddbc60fd9e5d0f058f to your computer and use it in GitHub Desktop.
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