# An example of the postage calculation function
import math
def calculate_postage(weight):
# round up to the next whole ounce
rounded_weight = math.ceil(weight)
# .47 for the first ounce, .21 per additional ounce
cost = .47 + (rounded_weight - 1) * .21
# if it's more than 3.5, the first ounce costs .94
if weight > 3.5:
cost = cost + .47
return cost