Местный биолог Нужна программа для прогнозирования роста населения. Входными данными будут:
- Первоначальное количество организмов
- Скорость роста (реальная число больше 1)
- Количество часов, необходимое для достижения этой скорости
- Количество часов, в течение которых население растет
Напишите программу, которая принимает эти входные данные и отображает их. прогноз общей численности населения.
Вот код, который у меня есть:
Код: Выделить всё
#Currently trying with 10, 2, 2, 6, giving a total pop of 10
organisms = int(input("Enter the initial number of organisms:"))
rateOfGrowth = int(input("Enter the rate of growth [a real number > 0]: "))
numOfHours = int(input("Enter the number of hours to achieve the rate of growth: "))
totalHours = int(input("Enter the total hours of growth: "))
totalOrganisms = organisms
while numOfHours >= totalHours:
organisms *= rateOfGrowth
totalOrganisms += organisms
numOfHours += numOfHours
print("The total population is ",totalOrganisms)
Подробнее здесь: https://stackoverflow.com/questions/544 ... per-output