← Back to challenges

The Actual Memory Size of your USB Flash Drive

PythonHardalgebrastringsmath

Instructions

Create a function that takes the memory size (MS is a string type) as an argument and returns the actual memory size.

Examples

actual_memory_size(32GB) ➞ 29.76GB

actual_memory_size(2GB) ➞ 1.86GB

actual_memory_size(512MB) ➞ 476MB

Notes

  • The actual storage loss on a USB device is 7% of the overall memory size!
  • If the actual memory size was greater than 1 GB, round your result to two decimal places.
  • If the memory size after adjustment is smaller then 1 GB, return the result in MB.
  • For the purposes of this challenge, there are 1000 MB in a Gigabyte.
python3
Loading editor…
to run
Walks through the solution with reasoning and edge cases.