Skip to content

Instantly share code, notes, and snippets.

@ahenaor
Created June 2, 2020 16:52
Show Gist options
  • Save ahenaor/55bbdaf748514f05b03ad9191aa487cf to your computer and use it in GitHub Desktop.
Save ahenaor/55bbdaf748514f05b03ad9191aa487cf to your computer and use it in GitHub Desktop.
Código 3 Entrevista Data Science Junior
def busqueda_vector (n, vector):
resultado = []
contador = 0
for i in range(len(vector)):
resultado = []
contador = 0
for j in range(i,len(vector)):
if contador < n:
contador = contador + vector[j]
resultado.append(vector[j])
elif contador > n:
break
else:
print(resultado)
break
vector = [ 3, 5, 1, 8, 3, 2, 1, 7, 2, 4, 5, 8, 1]
n = 10
busqueda_vector(n, vector)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment