about | help | code help+videos | done | prefs |
pond4
Exercise 4.1.18: Generalize the pond function so that it takes as parameters the number of years, the initial population, the harvest, and the annual growth rate (which in the book was 8% always). Your function should return the final population after that many years. Do not print anything. Your answer should be in the form of an integer, so use the int() command at the end. Assume rate is a number between 0 and 1. pond4(20, 12000, 1500, 0.08) → -12711 pond4(4, 12000, 800, 0.08) → 12720 pond4(1, 12000, 1500, 0) → 10500 ...Save, Compile, Run (ctrl-enter) |
Progress graphs:
Your progress graph for this problem
Random user progress graph for this problem
Random Epic Progress Graph
Copyright Nick Parlante 2017 - privacy