Problem 28 python

Yes, there are analytical and/or cleverer solutions,
but this is the way I came up with