From bf3748cebd4d0c5b8b4e92dd002c6a32f74af172 Mon Sep 17 00:00:00 2001 From: B Sunil kumar Date: Mon, 1 Dec 2025 15:13:08 +0530 Subject: [PATCH 1/2] add the docs for the sum_of_digits --- sum_of_digits_of_a_number.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/sum_of_digits_of_a_number.py b/sum_of_digits_of_a_number.py index 236de1d2c91..f606347e47c 100644 --- a/sum_of_digits_of_a_number.py +++ b/sum_of_digits_of_a_number.py @@ -49,7 +49,8 @@ def sum_of_digits(n: int) -> int: Compute the sum of the digits of an integer. Args: - n: A non-negative integer. + n:Non - negative integer + If the integer is negative , it is converted to postive interger and assigned to same number Returns: Sum of digits of the number. @@ -60,6 +61,7 @@ def sum_of_digits(n: int) -> int: >>> sum_of_digits(405) 9 """ + n=abs(n) total = 0 while n > 0: # Add last digit and remove it from n From 6c03320a203647f5cc01ce4425e78700fa32f0c7 Mon Sep 17 00:00:00 2001 From: B Sunil kumar Date: Mon, 1 Dec 2025 15:21:08 +0530 Subject: [PATCH 2/2] add the docs for the sum_of_digits --- README.md | 2 +- sum_of_digits_of_a_number.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index a1521508a59..39b9a0e9f22 100644 --- a/README.md +++ b/README.md @@ -58,4 +58,4 @@ Feel free to explore the scripts and use them for your learning and automation n 43. [smart_file_organizer.py](https://github.com/sangampaudel530/Python2.0/blob/main/smart_file_organizer.py) - Organizes files in a directory into categorized subfolders based on file type (Images, Documents, Videos, Audios, Archives, Scripts, Others). You can run it once or automatically at set intervals using the `--path` and `--interval` options.
-_**Note**: The content in this repository belongs to the respective authors and creators. I'm just providing a formatted README.md for better presentation._ +_**Note**: The content in this repository belongs to the respective authors and creators. I'm just providing a formatted README.md for better presentation. diff --git a/sum_of_digits_of_a_number.py b/sum_of_digits_of_a_number.py index f606347e47c..64d62b281b7 100644 --- a/sum_of_digits_of_a_number.py +++ b/sum_of_digits_of_a_number.py @@ -49,7 +49,7 @@ def sum_of_digits(n: int) -> int: Compute the sum of the digits of an integer. Args: - n:Non - negative integer + n:Non-negative integer If the integer is negative , it is converted to postive interger and assigned to same number Returns: