Vai al contenuto principale
๐Ÿ”’ Modalitร  anteprima. Le prime quindici lezioni di Foundations sono gratuite; questa รจ Pro. Avvia un trial di 7 giorni per sbloccare l'editor, i suggerimenti AI e il resto del programma. Carta richiesta, disdici in qualsiasi momento dalla Dashboard.Avvia trial di 7 giorni โ†’
โšก
โ† Corsiโ€บSenior Deep-DivesModule 4 ยท Memory + profiling ยท Recapโ€บGestione degli errori: eccezioni e tipi di risultatiquiz86 / 161
+100 XP
Compito๐ŸŒ 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

Domanda

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