Question: Python help: I am very confused on what to do. It needs to be a while loop but i have no clue how to go

Python help: I am very confused on what to do. It needs to be a while loop but i have no clue how to go about this! All the info is below!

Write a function called addmax(list, threshold) that adds up as many elements as possible from a list starting from the first item with sum less than a given threshold.(hint: use while loop)

For example,

print addmax([2,3,5,7],6) will get 5

print addmax([2,3,5,7],11) will get 10#because 2+3+5=10< 112+3+5+7=17>11

define your function below:

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!