From bbc75eaf3283b3be2ee335a31663b655b1bed05c Mon Sep 17 00:00:00 2001 From: baphim <269010393+baphim@users.noreply.github.com> Date: Wed, 30 Sep 2026 19:07:29 -0400 Subject: [PATCH] feat: P-1.30 completed and comments added --- lab-3_4/P-1.30.py | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/lab-3_4/P-1.30.py b/lab-3_4/P-1.30.py index 6ae7fbb..87d4b4f 100644 --- a/lab-3_4/P-1.30.py +++ b/lab-3_4/P-1.30.py @@ -16,8 +16,16 @@ def count_steps(): break # Handle ValueError and print error message except ValueError: - print('Invalid input: Please only enter integers.') - - + print('Invalid input: Please only enter integers.') + + # set 'step_count' variable to count divisions + step_count = 0 + # iterate divisions over 'current_value' until it is lower than 2 + while current_value >= 2: + current_value = current_value / 2 + # add division step to 'step_count' + step_count += 1 + print(step_count) + count_steps() \ No newline at end of file