{"id":9693,"date":"2016-02-04T14:10:37","date_gmt":"2016-02-04T19:10:37","guid":{"rendered":"http:\/\/blog.espol.edu.ec\/ccpg1001\/?p=9693"},"modified":"2026-04-05T18:07:55","modified_gmt":"2026-04-05T23:07:55","slug":"s2eva2015tii_t2-funcion-totalportipotabla","status":"publish","type":"post","link":"https:\/\/blog.espol.edu.ec\/algoritmos101\/fp-s2eva20\/s2eva2015tii_t2-funcion-totalportipotabla\/","title":{"rendered":"s2Eva2015TII_T2 funcion totalportipo(tabla)"},"content":{"rendered":"\n<p><strong><em>Ejercicio<\/em><\/strong>: <a href=\"https:\/\/blog.espol.edu.ec\/algoritmos101\/fp-2eva20\/2eva2015tii_t2-funcion-totalportipotabla\/\" data-type=\"post\" data-id=\"3042\">2Eva2015TII_T2 funcion totalportipo(tabla)<\/a><\/p>\n\n\n\n<p>Soluci\u00f3n propuesta en Python, contin\u00faa junto al tema 3.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Algoritmo en Python<\/h2>\n\n\n<div class=\"wp-block-syntaxhighlighter-code alignwide\"><pre class=\"brush: python; title: ; notranslate\" title=\"\">\n# ICM00794-Fundamentos de Computaci\u00f3n - FCNM-ESPOL\n# 2Eva_IIT2015_T2 funcion totalportipo(tabla)\n# propuesta de repaso: edelros@espol.edu.ec\n\nimport numpy as np\n\ndef totalportipo(tabla):\n    # Tama\u00f1o de tabla con codigoplaya,recolectado\n    n,k = tabla.shape  \n    \n    # verifica banderas repetido cambiando a 1\n    repetidos = np.zeros(n,dtype=int)\n    i = 0\n    while not(i&gt;=(n-1)):\n        j = i + 1\n        while not(j&gt;=n):\n            if (tabla&#x5B;i,0]==tabla&#x5B;j,0]):\n                repetidos&#x5B;j] = 1\n            j = j+1\n        i = i + 1\n    \n    # cuenta los que se eliminan\n    # para ver los m que son \u00fanicos\n    eliminar = 0\n    fila = 0\n    while not(fila&gt;=n):\n        eliminar = eliminar + repetidos&#x5B;fila]\n        fila = fila + 1\n    m = n-eliminar\n\n    # copiar codigos unicos en tabulado columna 0\n    tabulado = np.zeros(shape=(m,3), dtype=float)\n    fila = 0\n    j = 0\n    while not(fila&gt;=n):\n        if (repetidos&#x5B;fila]==0):\n            tabulado&#x5B;j,0] = tabla&#x5B;fila,0]\n            j = j + 1\n        fila = fila + 1\n\n    # Cuenta voluntarios por playa en tabulado columna 1\n    # Acumula recolectado por playa en tabulado columna 2\n    fila = 0\n    while not(fila&gt;=n):\n        cual = tabla&#x5B;fila,0]\n        # encuentra el \u00edndice en donde\n        donde = np.where(tabulado&#x5B;:,0]==cual) \n        tabulado&#x5B;donde,1] = tabulado&#x5B;donde,1] + 1\n        tabulado&#x5B;donde,2] = tabulado&#x5B;donde,2] + tabla&#x5B;fila,1]\n        fila = fila + 1\n\n    # acumula lo recolectado por playa\n    return(tabulado)\n<\/pre><\/div>","protected":false},"excerpt":{"rendered":"<p>Ejercicio: 2Eva2015TII_T2 funcion totalportipo(tabla) Soluci\u00f3n propuesta en Python, contin\u00faa junto al tema 3. Algoritmo en Python<\/p>\n","protected":false},"author":8043,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"wp-custom-template-entrada-fp-ejemplos","format":"standard","meta":{"footnotes":""},"categories":[136],"tags":[58,157],"class_list":["post-9693","post","type-post","status-publish","format-standard","hentry","category-fp-s2eva20","tag-ejemplos-python","tag-fundamentos-programacion"],"_links":{"self":[{"href":"https:\/\/blog.espol.edu.ec\/algoritmos101\/wp-json\/wp\/v2\/posts\/9693","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.espol.edu.ec\/algoritmos101\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.espol.edu.ec\/algoritmos101\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.espol.edu.ec\/algoritmos101\/wp-json\/wp\/v2\/users\/8043"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.espol.edu.ec\/algoritmos101\/wp-json\/wp\/v2\/comments?post=9693"}],"version-history":[{"count":5,"href":"https:\/\/blog.espol.edu.ec\/algoritmos101\/wp-json\/wp\/v2\/posts\/9693\/revisions"}],"predecessor-version":[{"id":23690,"href":"https:\/\/blog.espol.edu.ec\/algoritmos101\/wp-json\/wp\/v2\/posts\/9693\/revisions\/23690"}],"wp:attachment":[{"href":"https:\/\/blog.espol.edu.ec\/algoritmos101\/wp-json\/wp\/v2\/media?parent=9693"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.espol.edu.ec\/algoritmos101\/wp-json\/wp\/v2\/categories?post=9693"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.espol.edu.ec\/algoritmos101\/wp-json\/wp\/v2\/tags?post=9693"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}