Skip to content

Instantly share code, notes, and snippets.

@viniciusarre
Last active March 11, 2021 00:41
Show Gist options
  • Select an option

  • Save viniciusarre/1365254e8760e8aebbc9abd909154355 to your computer and use it in GitHub Desktop.

Select an option

Save viniciusarre/1365254e8760e8aebbc9abd909154355 to your computer and use it in GitHub Desktop.
# Better sollution
def main():
v = (1, 2, 3, 4, 5)
r = l = 1
print(bounded_ratio(v, l, r))
def bounded_ratio(a, l, r):
values = []
for i, v in enumerate(a):
values = values + [(i + 1) * x == v for x in range(l, r + 1)]
return values
if __name__ == '__main__':
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment