Python Upper Bound Calculator