Fixes #209: Handling argument list containing 0
s in NumberPartition
#245
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
0
, i.e.[0, 3, 7, 9]
will show a warning:Warning: Omitting zeros in the numbers list. Instantiate with keep0=True to keep 0 terms.
and remove the 0s from the list, unless the user specifically states to keep the zeros by instantiating
NumberPartition
with thekeep0=True
argument (False
by default).keep0=True
but the list does not contain any0
s, then the list remains unchanged.keep0=True
and the list contains at least one0
, then no warning is displayed and the list remains unchanged.0
is passed innumbers_list
inNumberPartition
problem #209Checklist
Type of change
How Has This Been Tested?
keep0
to see the functionality outside unit tests.Name the new unit-tests that you have added along with this change.
In
test_problems.py
, added a unit testtest_number_partitioning_handles_0_in_numbers()