Question: 4 . Create a Python ( or Pseudo Python ) function that solves how many non - negative integer solutions there are in a linear
Create a Pythonor Pseudo Python function that solves how many nonnegative integer solutions there are in a linear equation in the form:
xxxxldotsxellS
Where each xi variable may have some restriction on its value. The less than or equal to constraints are stored in a list lowerconstraints is stored if there is no constraint The upper bound constraints are stored in the list upperconstraints as PAIRS: i k indicating that xileq k and lenupperconstraintsleq Hint: Be careful of double constraints egleq xleq
Write a program that determines the number of nonnegative integer solutions. Your program should accept as input the variables LENGTH and VALUE S these should be defined constants at the top of your code
Your code should do the following:
Check the number of upper bound constraints, then appropriately compute the PIE for that number of constraints hint: you should have conditionals where you then have the formula for the set and set PIE
If one of your computations of setting aside bars yields a negative number of stars to place, you should ensure your code computes this to be
The lower constraints should be applied first and continue throughout your code.
Your code must be WELL COMMENTED your algorithmic structure should be very clear. If needed, it is recommended you also include a paragraph describing your code in your assignment essentially a README
Your code must be less than lines.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
