Hacker News new | ask | show | jobs
by sage92 732 days ago
```

total_plastic = 8.3e9 # total plastic in tons degradation_rate = 0.05 # degradation rate per day in percentage

# Calculation of daily degradation in tons daily_degradation = total_plastic * degradation_rate / 100

# Estimation of time taken to degrade all plastic in days total_days = total_plastic / daily_degradation

# Conversion of total days to years total_years = total_days / 365

# Print the result print(f"It would take approximately {total_years:.2f} years to degrade all the plastic.")

```

It would take approximately 5.48 years to degrade all the plastic.

3 comments

That’s… wrong? The amount of plastic would decrease every day (assuming no new production), so 0.05% of that amount would not be a constant number. Your daily_degradation is incorrect.
It's also not reasonable to assume that a growing organism will break down a smaller amount of stuff every day.
it's chatgpt of course it's wrong
Review exponential functions.
Yeah. Use the compounding interest rate function with the eat/expel/eat period.
I hope you don't estimate the earnings from your investments that way.

But +1 on f-string use.