Population dynamics 4

Strings

In this assignment, we will continue working with the information from the previous population analysis assignments.

Assigment

Write a Python script that includes the following functionalities.

  1. Ask the user for the following input: Population name, initial number, growth rate, time This information is provided as a single string, with each value separated by a comma.
  2. Split the information.
  3. Convert the population name to lowercase.
  4. If the population name contains the word β€œpopulation,” it should be removed from the population name.
  5. If there is a space before the population name, it should also be removed.
  6. Calculate the number of individuals after the specified time using the growth rate and initial number. We assume that the population grows according to unlimited growth; use the formula below:

    \[𝑁_𝑑=𝑁_0βˆ— 𝑒^{π‘Ÿβˆ—π‘‘}\]
  7. Print the sentence β€œIt is expected that the population x will grow from x to x in x years,” with x replaced by the population name, initial number, calculated number, and number of years, respectively. Use .format() for this.

Examples

    >>> population name,initial size,growth rate,time: ELEPHANTS,7806,0.039,20
    > It is expected that the population elephants will grow from 7806 to 17028 in 20 years.
    >>> population name,initial size,growth rate,time: Giraffespopulation,503,0.026,50
    > It is expected that the population giraffes will grow from 503 to 1845 in 50 years.
    >>> population name,initial size,growth rate,time: Population Lions,5003,0.030,30
    > It is expected that the population lions will grow from 5003 to 12305 in 30 years.