Uh oh!
There was an error while loading. Please reload this page.
Largest subarray sum - #1404
Conversation
cclauss
commented
Oct 19, 2019
Travis CI tests are failing. See CONTRIBUTING.md for details. This repo no longer supports legacy Python. https://travis-ci.com/TheAlgorithms/Python/builds/132670589#L352 |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
cclauss
commented
Oct 21, 2019
|
cclauss
commented
Oct 21, 2019
This is what a Pythonic function name, type hints, a doctest, and a default argument would look like. defmax_sub_array_sum(a: list, size: int=0):
""" >>> max_sub_array_sum([-13, -3, -25, -20, -3, -16, -23, -12, -5, -22, -15, -4, -7]) -3 """size=sizeorlen(a) |
anubhav-sharma13
commented
Oct 21, 2019
It is working on my system but the travis CI test failed |
cclauss
commented
Oct 21, 2019
On your system, what happens when you type:
|
Doctests are just docstrings until you run The problem that Travis is complaining about is that the doctest is using a Pythonic function name but the code is using a JavaScript-style function name. |
| def maxSubArraySum(a: list, size: int = 0): | ||
| def max_Sub_Array_Sum(a: list, size: int = 0): | ||
| """ | ||
| >>> max_sub_array_sum([-13, -3, -25, -20, -3, -16, -23, -12, -5, -22, -15, -4, -7]) |
There was a problem hiding this comment.
Let’s be Pythonic and use max_sub_array_sum everywhere.
* Insertion_sort * largest subarray sum * updated print command * removed extraspaces * removed sys.maxint * added explaination * Updated function style * Update largest_subarray_sum.py * Update i_sort.py * Delete bogo_bogo_sort.py
It contains the code of how to find the largest subarray sum in Python.