Free guide to Python programming

They give you this one with the hope you will purchase the remaining three volumes in the series.

But it’s still free and free is cheap. :wink:

Link to free Python volume

1 Like

This is an automatically-generated Wiki post for this new topic. Any member can edit this post and use it as a summary of the topic’s highlights.

This deal, for a different Python 3 book, is also free and looks pretty good:

A second free Python book deal

Free is cheap. You cannot go wrong at this price! :wink:

1 Like

On the topic of this website, many people use spreadsheets for finance calculation but they are poorly suited for anything except one off calculations. Anything that you want to use more than once should be implemented in a language like python. Python is extremely widely used and it has a great infrastructure, most of it free. It has a big user community who are constantly developing open source software toolboxes.

Here’s a search for reasons not to use spreadsheets

And another search for packages of python functions for finance


None of them mention why I shouldn’t use spreadsheet for personal finance, like budgeting, keeping track of all accounts, balances, bills, investments and trades, and doing taxes.

I actually considered “app-ifying” my spreadsheets, but decided it wouldn’t be worth it and wouldn’t make things any easier. For example, tax laws change all the time, and it would likely be much more difficult to make such changes in the application than on a spreadsheet.

Keeping track of my money wouldn’t be easier either – when I input a new charge, I have to select the account (for tracking the balance) and a category (for budgeting). It makes no difference whether I have to add an entry to a specific tab in a spreadsheet (or two) or add a transaction with multiple drop down boxes in some “app.”


Choosing the proper tool to solve a problem depends on the complexity of the problem and your skill with a particular application. There is usually a hierarchy of tools that you might use. For example, on a Linux desktop, you might start with a shell script, then escalate to awk, then perl. It depends on the capability of the tool and what you want to accomplish.

In a follow up post, I will give an example of a calculation that is too confusing when implemented as a spreadsheet.

If you want to use a spreadsheet for the personal finance calculations that you mention, you should still use good software practices: include comments, use named variables instead of spreadsheet addresses, e.g. income instead of A2.

Here is a website that offers good suggestions

Principle 1: Separate Data Entry From Reporting/Analysis
Principle 2: Group Sets of Data into Separate Tables
Principle 3: Let Excel do the Formula Work For You
While there are endless guides for writing better formulas, the best formula is one that you don’t have to write. Excel Tables and Pivot Tables allow you to analyze and calculate data while minimizing the number of formulas you need to write and manage. All of the reporting screenshots above are examples of Pivot Tables in use.

1 Like

see this post by #cruncher on the bogleheads. he presents spreadsheet implemented code to do some rate calculations for tips bonds. I think it would be a lot clearer to present python code, or some other high-level language, and then from the code to give the desired results.

1 Like

Says the guy who didn’t implement Lisp in Excel because that’s what I had and compilers for obscure languages weren’t on GitHub back in the day.

Anyway, the main benefit IMO of spreadsheets like Excel is you can see the intermediate calculation results and make sure they look reasonable as you go. Debugging a complicated computer program is a lot harder if you’re not sure what the answer is supposed to be.

I think debugging a complicated worksheet is harder and less reliable than debugging a high level language program. The link in my post above shows that the use of spreadsheets for scientific calculations is deprecated because they are hard to debug and verify. I think the same applies to financial calculations.

if you look at #crunchers code in the linked bogleheads post, he’s basically executing a function on a 1D array of numbers.

I am actually a MatLab fan and not that familiar with python. I’m pretty sure all of this can be done in python but I will stick to what I know.

In Matlab, this could be implemented as a single line of code. another single line of code could be used to plot the results. Another line could print the results.

if you have more lines of code, you can plot or print out the intermediate results, whichever is clearer to you.

IMO this is easier to understand and debug than a spreadsheet.

after reading #crunchers Excel code it relies on a builtin Excel function. these can be executed from a Matlab program as shown in the link below. this does add some complication but the function may be available in Matlab or from their file exchange. similarly python has a huge number of libraries of functions.

1 Like

I freely admit that this is a matter of personal taste and experience with a programming language. The example I chose from the bogleheads post may be too simple to demonstrate the advantage of implementing in a high level language. Also #cruncher does a good job in commenting his spreadsheets. But I find them harder to follow than a few lines of code.

1 Like

I think most spreadsheet models are similar to computer scripts, rather than complicated programs. They are meant to do what they’re intended and make sense to the author, but making sense to someone else is harder without a lot of documentation and/or thought about how they’re made (and why do that if you’re just doing it for yourself).