Question: I have this program already, and I need to configure it to round all outputs to 3 decimal places and be able to take command

I have this program already, and I need to configure it to round all outputs to 3 decimal places and be able to take command line inputs. I'm not sure where to go from here.
import numpy as np
def logistic(x, r):
return r * x *(1- x)
def simulate(x0, r, n_steps, output_file):
population = np.zeros(n_steps +1)
population[0]= x0
for i in range(1, n_steps +1):
population[i]= logistic(population[i -1], r)
round(population[i],3)
with open(output_file, "w") as f:
for i in range(n_steps +1):
f.write(f"{i}\t{population[i]}
")
if __name__=="__main__":
x0=2.5
r =0.1
n_steps =200
output_file = "population.txt"
simulate(x0, r, n_steps, output_file)

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!