{"id":9858,"date":"2014-08-03T08:00:27","date_gmt":"2014-08-03T13:00:27","guid":{"rendered":"http:\/\/blog.espol.edu.ec\/ccpg1001\/?p=9858"},"modified":"2026-04-05T18:30:27","modified_gmt":"2026-04-05T23:30:27","slug":"s3eva2002ti_t1-triunfos-empates-y-derrotas-por-goles","status":"publish","type":"post","link":"https:\/\/blog.espol.edu.ec\/algoritmos101\/fp-s3eva10\/s3eva2002ti_t1-triunfos-empates-y-derrotas-por-goles\/","title":{"rendered":"s3Eva2002TI_T1 Triunfos, empates y derrotas por Goles"},"content":{"rendered":"\n<p><strong>Ejercicio<\/strong>: <a href=\"https:\/\/blog.espol.edu.ec\/algoritmos101\/fp-3eva10\/3eva2002ti_t1-triunfos-empates-y-derrotas-por-goles\/\" data-type=\"post\" data-id=\"2479\">3Eva2002TI_T1 Triunfos, empates y derrotas por Goles<\/a><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Instrucciones en Python<\/h2>\n\n\n\n<p>explicaci\u00f3n en video:<\/p>\n\n\n\n<figure class=\"wp-block-embed is-type-video is-provider-youtube wp-block-embed-youtube wp-embed-aspect-16-9 wp-has-aspect-ratio\"><div class=\"wp-block-embed__wrapper\">\n<iframe loading=\"lazy\" title=\"Matrices - Ejercicio con arreglos, condicionales y acumuladores en Python. Matriz de goles\" width=\"500\" height=\"281\" src=\"https:\/\/www.youtube.com\/embed\/XwCwp3jFxhs?start=26&feature=oembed\" frameborder=\"0\" allow=\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share\" referrerpolicy=\"strict-origin-when-cross-origin\" allowfullscreen><\/iframe>\n<\/div><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">Algoritmo en Python<\/h2>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: python; title: ; notranslate\" title=\"\">\n# 3Eva_IT2002_T1 Triunfos, empates y derrotas por Goles\nimport numpy as np\n\n# INGRESO\ngoles = np.array(&#x5B;&#x5B;0,4,2,1],\n                  &#x5B;5,0,3,2],\n                  &#x5B;0,2,0,1],\n                  &#x5B;1,0,2,0]])\n\n# PROCEDIMIENTO\ntamano = np.shape(goles)\nn = tamano&#x5B;0]\nm = tamano&#x5B;1]\ntriunfos = np.zeros(shape=(n,m),dtype=int)\nttriunfos = np.zeros(n,dtype=int)\n# calcular los triunfos\ni = 0\nwhile not(i&gt;=n):\n    j = 0\n    while not(j&gt;=m):\n        if (goles&#x5B;i,j] &gt; goles&#x5B;j,i]):\n            triunfos&#x5B;i,j] = 1\n            triunfos&#x5B;j,i] = 0\n        j = j + 1\n    i = i + 1\n# calcular total de triunfos\ni = 0\nwhile not(i&gt;=n):\n    j = 0\n    while not(j&gt;=m):\n        ttriunfos&#x5B;i] = ttriunfos&#x5B;i] + triunfos&#x5B;i,j]\n        j = j + 1\n    i = i + 1\n\n# calcular empates\nempates = np.zeros(shape=(n,m),dtype=int)\ntempates = np.zeros(n,dtype=int)\ni = 0\nwhile not(i&gt;=n):\n    j = 0\n    while not(j&gt;=m):\n        if (goles&#x5B;i,j] == goles&#x5B;j,i]) and (i!=j):\n            empates&#x5B;i,j] = 1\n            empates&#x5B;j,i] = 1\n        j = j + 1\n    i = i + 1\n# calcular total de empates\ni = 0\nwhile not(i&gt;=n):\n    j = 0\n    while not(j&gt;=m):\n        tempates&#x5B;i] = tempates&#x5B;i] + empates&#x5B;i,j]\n        j = j + 1\n    i = i + 1\n\n# Derrotas\nderrotas = (n-1)*np.ones(n,dtype=int)\nderrotas = derrotas - ttriunfos - tempates\n\n# SALIDA\nprint(triunfos)\nprint(' triunfos por equipo: ')\nprint(ttriunfos)\nprint(empates)\nprint(' empates por equipo:')\nprint(tempates)\nprint(' derrotas por equipo:')\nprint(derrotas)\n<\/pre><\/div>","protected":false},"excerpt":{"rendered":"<p>Ejercicio: 3Eva2002TI_T1 Triunfos, empates y derrotas por Goles Instrucciones en Python explicaci\u00f3n en video: 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":[138],"tags":[58,157],"class_list":["post-9858","post","type-post","status-publish","format-standard","hentry","category-fp-s3eva10","tag-ejemplos-python","tag-fundamentos-programacion"],"_links":{"self":[{"href":"https:\/\/blog.espol.edu.ec\/algoritmos101\/wp-json\/wp\/v2\/posts\/9858","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=9858"}],"version-history":[{"count":3,"href":"https:\/\/blog.espol.edu.ec\/algoritmos101\/wp-json\/wp\/v2\/posts\/9858\/revisions"}],"predecessor-version":[{"id":23750,"href":"https:\/\/blog.espol.edu.ec\/algoritmos101\/wp-json\/wp\/v2\/posts\/9858\/revisions\/23750"}],"wp:attachment":[{"href":"https:\/\/blog.espol.edu.ec\/algoritmos101\/wp-json\/wp\/v2\/media?parent=9858"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.espol.edu.ec\/algoritmos101\/wp-json\/wp\/v2\/categories?post=9858"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.espol.edu.ec\/algoritmos101\/wp-json\/wp\/v2\/tags?post=9858"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}