Answer:
Following are the program to the given question:
def calculate_storage(filesize):#definging a method calculate_storage that takes filesize as a parameter
block_size = 4096#definging block_size that holds value
full_blocks = filesize//block_size#definging full_blocks that divides the value and hold integer part
partial_block_remainder = filesize%block_size#definging partial_block_remainder that holds remainder value
if partial_block_remainder > 0:#definging if that compare the value
return block_size*full_blocks+block_size#return value
return block_size*full_blocks#return value
print(calculate_storage(1)) # calling method by passing value
print(calculate_storage(4096)) # calling method by passing value
print(calculate_storage(4097)) # calling method by passing value
Output:
4096
4096
8192
Explanation:
In this code, a method "calculate_storage" is declared that holds a value "filesize" in its parameters, inside the method "block_size" is declared that holds an integer value, and defines "full_blocks and partial_block_remainder" variable that holds the quotient and remainder value and use it to check its value and return its calculated value. Outside the method, three print method is declared that calls the method and prints its return value.