diff --git a/python/population_plot.py b/python/population_plot.py new file mode 100644 index 0000000..1fe3bee --- /dev/null +++ b/python/population_plot.py @@ -0,0 +1,22 @@ +import matplotlib.pyplot as plt +import numpy as np + +# Initial population +population = 1_000_000 +death_rate = 0.10 +years = np.arange(0, 1001, 100) # 0 to 1000 years in 100-year intervals + +# Calculate population after each 100-year interval +population_values = [population] +for year in years[1:]: + population -= death_rate * population + population_values.append(population) + +# Create the graph +plt.figure(figsize=(8, 6)) +plt.plot(years, population_values, marker='o', linestyle='-', color='b') +plt.xlabel('Years') +plt.ylabel('Population') +plt.title('Population Projection') +plt.grid(True) +plt.show()