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 236de1d2c91..64d62b281b7 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