Please review my code for Problem set 3, 1 & 2. It works, but are there any suggested improvements? http://codepad.org/XWXumjsK
Your code looks good. Two minor things I would point out: try introducing docstrings in your code, it is easier to understand a function that way. Not that you have to use it everywhere, but just to give some insight for the user. Second thing, instead of x = savings... couldn't you just do accountBalance = savings + account balance, and then append accountBalance? I don't think you need a temp. variable in this case.
ah so you can use a variable in both the statement and the formula (are these the right terms?) have reveiewed as you suggested, thanks mate http://codepad.org/sYAoYyFs
Yeah, it's somewhat confusing, but you can do a assignment with the same variable name. (that's the core idea behind the for loop, for instance - i = some_value, i < limit, i = i + step). Another thing, I don't know if you are aware of this or not, but it's considered a more pythonic way - yeah, that's a word, :-) - to loop over a list using: http://codepad.org/K0qYPDOt . Not that much of a difference, just so you know different ways to loop over something.
Join our real-time social learning platform and learn together with your friends!