Can someone please show me how to convert this pseudocode to python using nested loops?

2 This doesn't work, since range/xrange take in integers. Or at least, they do on Python 2.6. – Brian Apr 13 '10 at 20:21 You're correct. Thanks for the tip.

– user37078 Apr 13 '10 at 20:26.

It should be about this: N=5 rates = i/100.0 for I in xrange(5,16,5) for r in rates: for p in xrange(1000, 1501, 1000): s = p*(1+r*N) c = p*(1+r)**N print s, c.

You can't use xrange/range directly since they require integer arguments. The way to do this is with a nice generator expression and a while loop, I think: # if N is the number of years, say so in the variable name numYears = 5 # start with 0.05, then 0.10, then 0.15 (the +1 is since xrange uses.

You can make it work with minimal changes to the pseudocode N=5 for rate in range(5, 15+1, 5): #+1 needed to include last term rate *= 0.01 for principle in range(1000, 1500+1, 1000): simple = principle * (1 + rate * N) compound = principle * (1 + rate)** N print str(simple) + " " + str(compound).

Pretty similar to KillianDS's but uses a generator expression. Saves you a couple of kB of memory (not that it matters). N = 5 for rate in (i / 100.0 for I in xrange(5, 15 + 1, 5)): for principle in xrange(1000, 1500 + 1, 1000): simple = principle * (1 + rate * N) compound = principle * (1 + rate) ** N print "%s %s" % (simple, compound).

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions