Sometimes the input from exercise 6 is not always provided with a comma as a separator. To allow for the option to input the data in a different way, modify the script from exercise 6 by adding an optional parameter for the separator. The output of the script should be the same as in exercise 6.
Schrijf een Python-script dat de volgende functionaliteiten bevat.
The function takes a string as an input argument:
““populationName, initialSize, growthRate, carryingCapacity”
This string is converted by the function into a list in the following format:
[populationName, InitialSize, growthRate, carryingCapacity]
Add the following two elements to the list:
a. The time point at which 99% of the carrying capacity is reached
b. The corresponding number
Assumption: The population experiences limited growth.
\[N_t = \frac{K}{1 + (\frac{K}{N_0}-1)* e^{-r*t}}\]Data elephants: [7806, 0.039, 50000, 162, 49517]
>>> complete_list_with_max_timepoint(elephants-7806-0.039-50000","-")
> Data elephants: [7806, 0.039, 50000, 162, 49517]
>>> complete_list_with_max_timepoint(giraffes,5603,0.026,6000")
> Data giraffes: [5603, 0.026, 6000, 179, 5995]
>>> complete_list_with_max_timepoint("Lions%5003%0.030%10000", "%")
> Data lions: [5003, 0.03, 10000, 176, 9949]