4.Write a program that will predict the size of a population of organisms. The program should ask for the starting number of organisms, their average daily population increase ( as a percentage), and the number of days they will multiply. For example, the population might begin with two organisms, have an average daily increase of 50 percent, and will be allowed to multiply for seven days. The program should use a loop to display the size of the population for each day. Input validation: Do not accept a number less than 2 for the starting size of the population. Do not accept a negative number for average daily population increase. Do not accept a number less than 1 for the number of days they will multiply.

Required Its Solution

Write a program that will predict the size of a population of organisms. The program should ask for the starting number of organisms, their average daily population increase (as a percentage), and the number of days they will multiply. For example, a population might begin with two organisms, have an average daily increase of 50%, and will be allowed to multiply for seven days. The program should use a loop to display the size of the population for each day

To write a program that predicts the size of a population of organisms, you can use the following algorithm:

1. Ask the user for the starting number of organisms, the average daily population increase as a percentage, and the number of days they will multiply.

2. Perform input validation to ensure the starting size is not less than 2, the daily population increase is not negative, and the number of days is not less than 1. If any of these conditions are not met, display an error message and ask for valid input.

3. Initialize a variable `population` to the starting number of organisms.

4. Use a loop to iterate through each day of multiplication. Within the loop, calculate the population size for the current day using the formula: `population = population + (population * (average_daily_increase / 100))`.

5. Display the population size for each day of multiplication.

Here's an example code implementation in Python that follows the above algorithm:

```python
def predict_population():
starting_population = int(input("Enter the starting number of organisms (minimum 2): "))
while starting_population < 2:
print("Starting population should be at least 2.")
starting_population = int(input("Enter the starting number of organisms (minimum 2): "))

average_daily_increase = float(input("Enter the average daily population increase (percentage): "))
while average_daily_increase < 0:
print("Average daily population increase cannot be negative.")
average_daily_increase = float(input("Enter the average daily population increase (percentage): "))

number_of_days = int(input("Enter the number of days for multiplication (minimum 1): "))
while number_of_days < 1:
print("Number of days should be at least 1.")
number_of_days = int(input("Enter the number of days for multiplication (minimum 1): "))

population = starting_population

print("Day \t Population")
print("---------------------")
for day in range(1, number_of_days + 1):
print(day, "\t", round(population))
population += population * (average_daily_increase / 100)

predict_population()
```

This program prompts the user to enter the starting number of organisms, average daily population increase, and number of days for multiplication. It then performs input validation to ensure the validity of the inputs. Finally, it calculates and displays the population size for each day of multiplication.