Write a function called `filler(A, l)` that takes an integer `A`, and a list of integers `l` and if some of the numbers

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
Site Admin
Posts: 899603
Joined: Mon Aug 02, 2021 8:13 am

Write a function called `filler(A, l)` that takes an integer `A`, and a list of integers `l` and if some of the numbers

Post by answerhappygod »

Write a function called `filler(A, l)`
that takes an integer `A`, and a list of integers `l`
and if some of the numbers in `l` sum up to `A` then
it returns a list of these numbers. Otherwise, it returns
`None`. For example,
filler(5, [1,6,3,4]) returns [1,4].
filler(5, [1,6,3,7]) returns None.
filler(0, [-1,-1,2,-3]) returns [-1,-1,2].
filler(10, [2,3,2,3,1]) returns [2,3,2,3].
If there are multiple answers, then return any of them.
You can use each number in the list once for each occurence.
"""
def filler(A, l):
# remove the following line to solve this question
return
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply