I have an initial value that's increasing at a certain percent annually(5.5%). My program is required to print out the year when the initial value is 2, 3, and 4 times greater than the original value using while loops only. So far, I'm using three while loops that finds when the initial value has been 2, 3, and 4 times greater than the original value but as of now it works, but it looks really repetitive. This is what I have so far:
anum 123.45 #initial value
anum2 = initial * 2 #supposedly the numbers to indicate when the initial value has doubled, tripled, quadrupled etc.
anum3 = initial * 3
anum4 = initial * 4
initialYear = 2017
year = initialYear #year counter
while anum <= anum2: #make the loop stop before going further than two times greater than initial value
growth = anum * 0.055
anum = growth + anum
year += 1
print("Overall points will be 2 times 2017 points in {:d} years ({:d}).".format\
(year - 2017, year))
while anum <= anum3:
growth = anum * 0.055
anum = growth + anum
year += 1
print("Overall points will be 3 times 2017 points in {:d} years ({:d}).".format\
(year - 2017, year))
while anum <= anum4:
growth = anum * 0.055
anum = growth + anum
year += 1
print("Overall points will be 4 times 2017 points in {:d} years ({:d}).".format\
(year - 2017, year))
Is there a way where I could potentially have this process going using a nested while loop in order to reduce its overall repetitiveness?
Any help is greatly appreciated!