DEV Community

Discussion on: Welcome Thread - v17

Collapse
 
thebadgateway profile image
Will F

Hi. I am free to work on numerical projects until mid-November 2018. I use python, bash, and C. I don't really understand anything about web development. I like linear algebra, computing and recursion, Monte Carlo methods, stats and orthogonal functions, and things that feel so very true (like gravity, thermodynamics, and so on). Here is the "premise + code (in python)" I show to people who are interested in learning to program:

"""
Suppose my salary is $25,000.00 per year, and I get a 3% raise every year working and living in this fine city of mine, Boston. Given that the minimum salary required to SURVIVE in Boston is $60,000.00 per year (it's factually thereabouts), how many years will it take for my salary to reach this "minimum required salary to survive in Boston" (ignoring inflation here)?

The basic scheme with paper and pen would be:

25000 + 25000*0.03 = 25000 + 750 = 25750 (first year)

25750 + 25750*0.03 = 25750 + 772.50 = 26522.50 (second year)

...

Ok, it does feel nice to write, but I'm only two years in, and $1.5K away from $25K. Bleck.

We can put together a routine to find the number of years with just 6 lines:

years = 0
salary = 25000.00
while salary < 60000.00:
salary = salary + 0.03 * salary
years = years + 1
print(years)
"""

How many years?