Naar hoofdinhoud
πŸ”’ Voorbeeldmodus. De eerste vijftien Foundations-lessen zijn gratis; deze is Pro. Start een 7-daagse trial om de editor, AI-hints en de rest van het curriculum te ontgrendelen. Kaart vereist, op elk moment opzegbaar in Dashboard.Start 7-daagse trial β†’
⚑
← Cursussenβ€ΊSenior Deep-DivesModule 4 Β· Memory + profiling Β· Recapβ€ΊFoutafhandeling: uitzonderingen versus resultaattypenquiz86 / 161
+100 XP
Opdracht🌐 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.
🎯 Quiz

Vraag

πŸ“ **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.