Question
(Python) 1) Implement a function that takes in a list of Number as the first parameter, and a single Number as its second parameter. Using
(Python)
1) Implement a function that takes in a list of Number as the first parameter, and a single Number as its second parameter. Using a While loop, start summing the elements of the list but make sure that the summation does not pass the second parameter. The second parameter is essentially the limit. This function should return 2 items. First item is the actual sum of the elements, and this item should always be equal or less than the second parameter. The second item is the list of numbers that you actually summed up, so this should be a subset of the first parameter.
2) Implement question 1, but using a For Loop instead of a While Loop
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started