🔒 Modo vista previa. Las primeras quince lecciones de Foundations son gratis; esta es Pro. Inicia un trial de 7 días para desbloquear el editor, las pistas AI y el resto del programa. Tarjeta requerida, cancela cuando quieras en Dashboard.Iniciar trial de 7 días →
← Cursos›Senior Deep-Dives›Module 4 · Memory + profiling · Recap›Manejo de errores: excepciones frente a tipos de resultadosquiz86 / 161
+100 XP
Tarea🌐 shown in EN
📝 **Task:** Build a small \`memory_estimator(rows, bytes_per_row, overhead_pct)\` that returns total memory in MB (float, 2 decimals):
\`\`\`
total_bytes = rows * bytes_per_row * (1 + overhead_pct / 100)
mb = total_bytes / 1_000_000 # decimal MB — matches Prometheus/Grafana convention
return round(mb, 2)
\`\`\`
Test for 3 realistic scales: small in-memory cache, mid-size pandas DataFrame, large Redis dataset.
📋 Implement the function above. Tests run automatically.
💡 **Hint:** Re-read the theory if you get stuck.
🎯 Cuestionario
Pregunta
📝 **Task:** Build a small \`memory_estimator(rows, bytes_per_row, overhead_pct)\` that returns total memory in MB (float, 2 decimals):
\`\`\`
total_bytes = rows * bytes_per_row * (1 + overhead_pct / 100)
mb = total_bytes / 1_000_000 # decimal MB — matches Prometheus/Grafana convention
return round(mb, 2)
\`\`\`
Test for 3 realistic scales: small in-memory cache, mid-size pandas DataFrame, large Redis dataset.
📋 Implement the function above. Tests run automatically.
💡 **Hint:** Re-read the theory if you get stuck.