From ea387cc83bd03c170c0fe3160daad3d9ea31f812 Mon Sep 17 00:00:00 2001 From: TheCoder1232 <72138846+TheCoder1232@users.noreply.github.com> Date: Wed, 30 Sep 2020 21:12:47 +0530 Subject: [PATCH] Added Comments --- Python/TestFor9.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/Python/TestFor9.py b/Python/TestFor9.py index b5885f6..0cd0b03 100644 --- a/Python/TestFor9.py +++ b/Python/TestFor9.py @@ -3,14 +3,14 @@ def test_for_9(quotient): a multiple of 9, without using the modulo operator. This can be done, by checking if the digit sum, is 9, once it gets to be a single digit.""" - digit_sum = int(quotient) - while digit_sum > 9: - digits = str(digit_sum) + digit_sum = int(quotient) # Takes the given number and convert into int + while digit_sum > 9: # Checks if the number provided by user is greater than 9 + digits = str(digit_sum) # Convert digits into string for individual purpose total = 0 - for digit in digits: - total += int(digit) + for digit in digits: # For loop to use individual digit for digit sum + total += int(digit) # Adds each digit to get digit sum digit_sum = total - if digit_sum == 9: + if digit_sum == 9: # If loop for digit sum == 9 return True else: return False