Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
<hr>

_**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.
4 changes: 3 additions & 1 deletion sum_of_digits_of_a_number.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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
Expand Down