Last active
May 26, 2021 20:15
-
-
Save mathigatti/fbc49d043ab1fff8786e866e9b91d315 to your computer and use it in GitHub Desktop.
Take exams on colab. Answers are saved into a CSV
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"nbformat": 4, | |
"nbformat_minor": 0, | |
"metadata": { | |
"colab": { | |
"name": "exam.ipynb", | |
"provenance": [], | |
"collapsed_sections": [], | |
"include_colab_link": true | |
}, | |
"kernelspec": { | |
"name": "python3", | |
"display_name": "Python 3" | |
}, | |
"language_info": { | |
"name": "python" | |
} | |
}, | |
"cells": [ | |
{ | |
"cell_type": "markdown", | |
"metadata": { | |
"id": "view-in-github", | |
"colab_type": "text" | |
}, | |
"source": [ | |
"<a href=\"https://colab.research.google.com/gist/mathigatti/fbc49d043ab1fff8786e866e9b91d315/exam.ipynb\" target=\"_parent\"><img src=\"https://colab.research.google.com/assets/colab-badge.svg\" alt=\"Open In Colab\"/></a>" | |
] | |
}, | |
{ | |
"cell_type": "markdown", | |
"metadata": { | |
"id": "XwwFJMOyrffm" | |
}, | |
"source": [ | |
"## Examen de Python\n", | |
"\n", | |
"Nota: **vale Googlear!** buscando específicamente la operación que quieren realizar, ej, \"python separar un string\" (en inglés mejor), van a encontrar la respuesta en StackOverflow (o sitio similar).\n", | |
"\n", | |
"\n", | |
"¡Muchos éxitos!" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"metadata": { | |
"id": "knUILPEyi_Wb", | |
"colab": { | |
"base_uri": "https://localhost:8080/" | |
}, | |
"cellView": "form", | |
"outputId": "e003692a-c63a-42e9-f405-95a19ce84d54" | |
}, | |
"source": [ | |
"#@markdown # Datos del alumno\n", | |
"\n", | |
"from datetime import datetime, timedelta\n", | |
"print((datetime.now() - timedelta(hours=3)).strftime(\"%m/%d/%Y, %H:%M:%S\"))\n", | |
"\n", | |
"nombre = 'Pedro' #@param {type:\"string\"}\n", | |
"apellido = \"Garcia\" #@param {type:\"string\"}\n", | |
"mail = 'pedro.garcia@ejemplo.com.ar' #@param {type:\"string\"}\n", | |
"\n", | |
"respuestas = {\"nombre\": nombre, \"apellido\": apellido, \"mail\": mail}" | |
], | |
"execution_count": null, | |
"outputs": [ | |
{ | |
"output_type": "stream", | |
"text": [ | |
"05/26/2021, 15:54:25\n" | |
], | |
"name": "stdout" | |
} | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"metadata": { | |
"cellView": "form", | |
"id": "04bg0caqBy8j" | |
}, | |
"source": [ | |
"#@markdown # Cuestionario\n", | |
"#@markdown ### Marque la respuesta correcta" | |
], | |
"execution_count": null, | |
"outputs": [] | |
}, | |
{ | |
"cell_type": "code", | |
"metadata": { | |
"cellView": "form", | |
"id": "m0TR7XgSB1di" | |
}, | |
"source": [ | |
"\n", | |
"#@markdown #### 1. El lenguaje de programación más extendido actualmente en IA y ciencia de datos es:\n", | |
"respuesta = \"No se\" #@param [\"No se\", \"Anaconda\", \"Google Colaboratory\", \"Python\", \"Jupyter Notebook\", \"R\"]\n", | |
"respuestas[\"pregunta_1\"] = respuesta\n" | |
], | |
"execution_count": null, | |
"outputs": [] | |
}, | |
{ | |
"cell_type": "code", | |
"metadata": { | |
"cellView": "form", | |
"id": "LNxm0lPzB2Oy" | |
}, | |
"source": [ | |
"\n", | |
"#@markdown #### 2. Un algoritmo es:\n", | |
"respuesta = \"No se\" #@param [\"No se\", \"Una secuencia de variables que resultan en un total\", \"Una serie de frecuencias percusivas que codifican información cinética\", \"Una serie de instrucciones a realizar paso a paso para llegar a una solución\", \"Un programa en Python que calcula un resultado\"]\n", | |
"respuestas[\"pregunta_2\"] = respuesta\n" | |
], | |
"execution_count": null, | |
"outputs": [] | |
}, | |
{ | |
"cell_type": "code", | |
"metadata": { | |
"colab": { | |
"base_uri": "https://localhost:8080/", | |
"height": 80 | |
}, | |
"cellView": "form", | |
"id": "f3Arrhq_B4S4", | |
"outputId": "1f6fab9b-13cf-4048-88fc-b25f1e201188" | |
}, | |
"source": [ | |
"#@markdown # Entregar examen\n", | |
"\n", | |
"#@markdown Anda a \"Entorno de ejecución\" -> \"Ejecutar todo\"\n", | |
"\n", | |
"#@markdown Se te debería descargar un archivo de texto con tus respuestas pocos segundos despues de que se ejecuto esta celda.\n", | |
"\n", | |
"import pandas as pd\n", | |
"exam_path = f\"python_examen_{nombre}_{apellido}.csv\"\n", | |
"df = pd.DataFrame([respuestas])\n", | |
"df.to_csv(exam_path,index=False)\n", | |
"from google.colab import files\n", | |
"files.download(exam_path)\n", | |
"df" | |
], | |
"execution_count": null, | |
"outputs": [ | |
{ | |
"output_type": "display_data", | |
"data": { | |
"application/javascript": [ | |
"\n", | |
" async function download(id, filename, size) {\n", | |
" if (!google.colab.kernel.accessAllowed) {\n", | |
" return;\n", | |
" }\n", | |
" const div = document.createElement('div');\n", | |
" const label = document.createElement('label');\n", | |
" label.textContent = `Downloading \"${filename}\": `;\n", | |
" div.appendChild(label);\n", | |
" const progress = document.createElement('progress');\n", | |
" progress.max = size;\n", | |
" div.appendChild(progress);\n", | |
" document.body.appendChild(div);\n", | |
"\n", | |
" const buffers = [];\n", | |
" let downloaded = 0;\n", | |
"\n", | |
" const channel = await google.colab.kernel.comms.open(id);\n", | |
" // Send a message to notify the kernel that we're ready.\n", | |
" channel.send({})\n", | |
"\n", | |
" for await (const message of channel.messages) {\n", | |
" // Send a message to notify the kernel that we're ready.\n", | |
" channel.send({})\n", | |
" if (message.buffers) {\n", | |
" for (const buffer of message.buffers) {\n", | |
" buffers.push(buffer);\n", | |
" downloaded += buffer.byteLength;\n", | |
" progress.value = downloaded;\n", | |
" }\n", | |
" }\n", | |
" }\n", | |
" const blob = new Blob(buffers, {type: 'application/binary'});\n", | |
" const a = document.createElement('a');\n", | |
" a.href = window.URL.createObjectURL(blob);\n", | |
" a.download = filename;\n", | |
" div.appendChild(a);\n", | |
" a.click();\n", | |
" div.remove();\n", | |
" }\n", | |
" " | |
], | |
"text/plain": [ | |
"<IPython.core.display.Javascript object>" | |
] | |
}, | |
"metadata": { | |
"tags": [] | |
} | |
}, | |
{ | |
"output_type": "display_data", | |
"data": { | |
"application/javascript": [ | |
"download(\"download_ebefd4f8-7514-4271-8407-bb95f4fe05bb\", \"python_examen_Pedro_Garcia.csv\", 94)" | |
], | |
"text/plain": [ | |
"<IPython.core.display.Javascript object>" | |
] | |
}, | |
"metadata": { | |
"tags": [] | |
} | |
}, | |
{ | |
"output_type": "execute_result", | |
"data": { | |
"text/html": [ | |
"<div>\n", | |
"<style scoped>\n", | |
" .dataframe tbody tr th:only-of-type {\n", | |
" vertical-align: middle;\n", | |
" }\n", | |
"\n", | |
" .dataframe tbody tr th {\n", | |
" vertical-align: top;\n", | |
" }\n", | |
"\n", | |
" .dataframe thead th {\n", | |
" text-align: right;\n", | |
" }\n", | |
"</style>\n", | |
"<table border=\"1\" class=\"dataframe\">\n", | |
" <thead>\n", | |
" <tr style=\"text-align: right;\">\n", | |
" <th></th>\n", | |
" <th>nombre</th>\n", | |
" <th>apellido</th>\n", | |
" <th>mail</th>\n", | |
" <th>pregunta_1</th>\n", | |
" <th>pregunta_2</th>\n", | |
" </tr>\n", | |
" </thead>\n", | |
" <tbody>\n", | |
" <tr>\n", | |
" <th>0</th>\n", | |
" <td>Pedro</td>\n", | |
" <td>Garcia</td>\n", | |
" <td>pedro.garcia@emplo.com.ar</td>\n", | |
" <td>No se</td>\n", | |
" <td>No se</td>\n", | |
" </tr>\n", | |
" </tbody>\n", | |
"</table>\n", | |
"</div>" | |
], | |
"text/plain": [ | |
" nombre apellido mail pregunta_1 pregunta_2\n", | |
"0 Pedro Garcia pedro.garcia@emplo.com.ar No se No se" | |
] | |
}, | |
"metadata": { | |
"tags": [] | |
}, | |
"execution_count": 8 | |
} | |
] | |
}, | |
{ | |
"cell_type": "markdown", | |
"metadata": { | |
"id": "OKQz9n1-0DAy" | |
}, | |
"source": [ | |
"¡Muchas Gracias! \n", | |
"Cualquier consulta estamos a disposición por el canal de <a href='https://join.slack.com/t/ihumai/shared_invite/zt-fr1gdg51-VOrVPEJHEbCyi2VkSX727Q'>Slack</a>. \n", | |
"\n", | |
"\n", | |
"<table>\n", | |
"<td>\n", | |
"<img src=https://ihum.ai/static/logos/isologotipo-instituto.png width='150px'>\n", | |
"<br>\n", | |
"<br>\n", | |
"<center>\n", | |
"<a href=\"https://www.instagram.com/ihum.ai/?hl=es-la\"> \n", | |
"<img src=\"https://ihum.ai/static/icons/ig.png\" width=\"30px\" alt=\"IG\"></a><a href=\"https://github.com/institutohumai\"><img src=\"https://ihum.ai/static/icons/github_b.png\" width=\"30px\" alt=\"Git\"></a><a href=\"https://www.linkedin.com/company/instituto-humai/\"><img src=\"https://ihum.ai/static/icons/linkedin.png\" width=\"30px\" alt=\"LinkedIn\"></a><a href=\"https://www.facebook.com/iHumai\"><img src=\"https://ihum.ai/static/icons/fb.svg\" width=\"30px\" alt=\"FB\"></a><a href=\"https://join.slack.com/t/ihumai/shared_invite/zt-fr1gdg51-VOrVPEJHEbCyi2VkSX727Q\"><img\n", | |
" src=\"https://ihum.ai/static/icons/slack.png\" width=\"30px\" alt=\"Slack\"></a></center>\n", | |
"<td>\n", | |
"</td>\n", | |
"<td>\n", | |
"</td>\n", | |
"<td>\n", | |
"</td>\n", | |
"</table>" | |
] | |
} | |
] | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment