So, I think I'm on the wrong track here. I want to count how often I can fold a standard paper until one of its measurements (width or height) reaches 0. The folding is simulated by dividing only the bigger measurement by two. So here's what I've come up with:
def count_folds(width: int, height: int) -> int:
counter = 0
while width > 0 and height > 0:
if max(width, height) == width:
width = folding(width)
elif max(width, height) == height:
height = folding(height)
counter += 1
return counter
def folding(x):
return x / 2
But when I run this code for these two examples
print("count_folds: ", count_folds(2, 1))
print("count_folds: ", count_folds(15, 7))
,then I get very large numbers (which I'm not expecting). What am I doing wrong?
Thanks for any help guys!