Skip to content

Instantly share code, notes, and snippets.

@ahenaor
Created June 2, 2020 16:13
Show Gist options
  • Select an option

  • Save ahenaor/6b096c8f5bb23711ba3586a936794005 to your computer and use it in GitHub Desktop.

Select an option

Save ahenaor/6b096c8f5bb23711ba3586a936794005 to your computer and use it in GitHub Desktop.

Revisions

  1. ahenaor created this gist Jun 2, 2020.
    23 changes: 23 additions & 0 deletions 1_codigo_1.py
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,23 @@
    def busqueda_vector (n, vector):
    resultado = []
    contador = 0
    for i in range(len(vector)):

    if contador < n:
    contador = contador + vector[i]
    resultado.append(vector[i])

    elif contador > n:
    resultado = []
    contador = vector[i]
    else:
    print(resultado)
    break
    print(vector[i])
    print(contador)
    print("="*50)

    vector = [ 3, 5, 1, 8, 3, 2, 1, 7, 2, 4, 5, 8, 1]
    n = 10

    busqueda_vector(n, vector)