anonymous
  • anonymous
psy4 part b. how do you create a while loop that runs until it reaches the last item in a list? i'm trying to run through the second problem in problem set 4 and need to create a condition for looping through the list of growth rates. am i thinking about this correctly or is there a better set of criteria for the while loop? here's my code so far: http://dpaste.com/546068/
MIT 6.00 Intro Computer Science (OCW)
chestercat
  • chestercat
I got my questions answered at brainly.com in under 10 minutes. Go to brainly.com now for free help!
At vero eos et accusamus et iusto odio dignissimos ducimus qui blanditiis praesentium voluptatum deleniti atque corrupti quos dolores et quas molestias excepturi sint occaecati cupiditate non provident, similique sunt in culpa qui officia deserunt mollitia animi, id est laborum et dolorum fuga. Et harum quidem rerum facilis est et expedita distinctio. Nam libero tempore, cum soluta nobis est eligendi optio cumque nihil impedit quo minus id quod maxime placeat facere possimus, omnis voluptas assumenda est, omnis dolor repellendus. Itaque earum rerum hic tenetur a sapiente delectus, ut aut reiciendis voluptatibus maiores alias consequatur aut perferendis doloribus asperiores repellat.

Get this expert

answer on brainly

SEE EXPERT ANSWER

Get your free account and access expert answers to this
and thousands of other questions

anonymous
  • anonymous
I used a for loop instead of a while loop like this: for year in range(1,len(growthRates)+1): that will get the length of the growthRates list and I add one more to include the last element. Hope that helps!
anonymous
  • anonymous
I used a for loop too. If you really want to use while you can use while(i

Looking for something else?

Not the answer you are looking for? Search for more explanations.