The Geek Blog

View Original

Couple of lines of code for saving money.

I saw a post the other day on Instagram from a couple saving for a deposit for a house. What they have done is get a pack of 100 envelopes, write on them 1, next envelope 2, all the way up until each envelope has a number. Each week they each pick an envelope and put that amount of cash into that envelope. When they are all done you will have £5,050.

Now you may want to adjust this so it will be one a week for each week of the year, so 52 envelopes, you will still save £1,378 over the year. Could get more adventurous, do it each day, for each day of the month, based on 31 days you will save £496 a month, not too bad.

Anyway like my previous post on automated savings, I have written some code that will pick a random number from 1 to 100 and flash that up on the screen, when I get that number I will transfer that amount into an account, not a bad way to save up for a holiday or something. This is part one, I will enhance this to text me each Saturday with the amount to save.

All you need is create a txt file called money.txt, and type in 1 to a 100 and save the file in the same location. Then copy the code below into money.py. This is rough code, took me about 10 mins, if you think this can be reduced please get in contact.

See this content in the original post