-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathorganisms.py
More file actions
24 lines (21 loc) · 950 Bytes
/
organisms.py
File metadata and controls
24 lines (21 loc) · 950 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
################################################################################
# Descriptions: Predicts the approximate size of population of organisms
# Calculate the average daily population & number of days left
################################################################################
# Input
num_start = float(input("Starting number, in million: "))
rate_daily = float(input("Average daily increase, in percent: "))
days = int(input("Number of days to multiply: "))
rate_daily /= 100
population = num_start
# Calculation
#print("Day", "Approx. Pop", sep="\t")
print("Day Approx. Pop")
for current_day in range(1, days + 1):
# print(f"{current_day:3,.0f}", format(population,'15,.4f'), sep="")
print(f"{current_day:3,.0f}", format(population,'13,.4f'))
population = population + (rate_daily * population)
# Expected output (from homework example)
# Day Approx. prop
# 1 2.0000
# 2 2.6000