Storage Unit Converter
Write a function bytes_to_unit(num_bytes, unit) that converts a number of bytes into the given unit ("KB", "MB" or "GB", using 1024 as the base), rounded to 2 decimal places.
Read num_bytes (an integer) then unit (a string) from input, and print the result.
Example: input 30000, KB → output 29.3.
main.py
Loading editor…
Console
Run your code to see output here.