-
-
Notifications
You must be signed in to change notification settings - Fork 50.4k
Add a_very_big_sum algorithm to maths folder #13642
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 7 commits
4c6121d
2e5b898
aceb290
fe8c677
7a0f653
2666979
1a23da0
ca7004d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| def a_very_big_sum(arr: list[int]) -> int: | ||
| """ | ||
| Return the sum of all integers in the input array. | ||
|
|
||
| >>> a_very_big_sum([2, 4, 6]) | ||
| 12 | ||
| >>> a_very_big_sum([]) | ||
| 0 | ||
| """ | ||
| total = 0 | ||
| for i in arr: | ||
| total += i | ||
| return total | ||
|
|
||
| if __name__ == "__main__": | ||
| # Example usage | ||
| arr = [2, 4, 6, 2, 4, 6, 3] | ||
| result = a_very_big_sum(arr) | ||
| print(f"Sum of {arr} is {result}") | ||
| <<<<<<< HEAD | ||
|
Check failure on line 20 in maths/special_numbers/a_very_big_sum.py
|
||
|
|
||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. An error occurred while parsing the file: Traceback (most recent call last):
File "/opt/render/project/src/algorithms_keeper/parser/python_parser.py", line 146, in parse
reports = lint_file(
^^^^^^^^^^
libcst._exceptions.ParserSyntaxError: Syntax Error @ 21:1.
parser error: error at 20:2: expected one of (, *, +, -, ..., AWAIT, EOF, False, NAME, NUMBER, None, True, [, break, continue, elif, else, lambda, match, not, pass, ~
<<<<<<< HEAD
^ |
||
|
|
||
| ======= | ||
|
Check failure on line 23 in maths/special_numbers/a_very_big_sum.py
|
||
| >>>>>>> 7a0f65306d224f3917a3caf23997f850c21cbb6a | ||
|
Check failure on line 24 in maths/special_numbers/a_very_big_sum.py
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
An error occurred while parsing the file:
maths/special_numbers/a_very_big_sum.py