title: What's wrong with this storage calculator?
body: <p>I'm new to python, and this question appeared on a course.</p>
  <pre><code>def calculate_storage(filesize):
      block_size = 4096
      # Use floor division to calculate how many blocks are fully occupied
      full_blocks = filesize // block_size
      # Use the modulo operator to check whether there's any remainder
      partial_block_remainder = filesize % block_size
      # Depending on whether there's a remainder or not, return
      # the total number of bytes required to allocate enough blocks
      # to store your data.
      if partial_block_remainder &gt; 0:
          return full_blocks+1
      return full_blocks
  
  print(calculate_storage(1))    # Should be 4096
  print(calculate_storage(4096)) # Should be 4096
  print(calculate_storage(4097)) # Should be 8192
  print(calculate_storage(6000)) # Should be 8192
  </code></pre>
  <p>This was my answer. The question was this:
  <a href="https://i.stack.imgur.com/QYval.png" rel="nofollow noreferrer">If a filesystem has a block size of 4096 bytes, this means that a file comprised of only one byte will still use 4096 bytes of storage. A file made up of 4097 bytes will use 4096*2=8192 bytes of storage. Knowing this, can you fill in the gaps in the calculate_storage function below, which calculates the total number of bytes needed to store a file of a given size?</a></p>
  <p>With the base code here:</p>
  <pre><code>def calculate_storage(filesize):
      block_size = 4096
      # Use floor division to calculate how many blocks are fully occupied
      full_blocks = ___
      # Use the modulo operator to check whether there's any remainder
      partial_block_remainder = ___
      # Depending on whether there's a remainder or not, return
      # the total number of bytes required to allocate enough blocks
      # to store your data.
      if partial_block_remainder &gt; 0:
          return ___
      return ___
  
  print(calculate_storage(1))    # Should be 4096
  print(calculate_storage(4096)) # Should be 4096
  print(calculate_storage(4097)) # Should be 8192
  print(calculate_storage(6000)) # Should be 8192
  </code></pre>
  <p><a href="https://i.stack.imgur.com/OyyKf.png" rel="nofollow noreferrer">The Incorrect statement was this:
  Not quite. One concept to keep in mind is the difference
  between float division (/) and floor division (//). Floor
  division rounds down to the nearest whole number, which is
  useful for this question. Use filesize // block_size to get
  the amount of full blocks. Something else to remember here
  is the format of modulo arithmetic. The divisor is always to
  the right of the modulo operator. E.g.- 2 = 6 % 4 &lt;- This is
  the divisor.</a></p>