Re: function that counts...

2010-05-19 Thread René 'Necoro' Neumann
Am 19.05.2010 21:58, schrieb superpollo: ... how many positive integers less than n have digits that sum up to m: In [197]: def prttn(m, n): tot = 0 for i in range(n): s = str(i) sum = 0 for j in range(len(s)): sum += int(s[j]) if sum

Re: function that counts...

2010-05-19 Thread René 'Necoro' Neumann
Am 19.05.2010 22:58, schrieb superpollo: In [277]: prttn(25, 1) Out[277]: 348 In [278]: prttn2(25, 1) Out[278]: 348 In [279]: prttn3(25, 1) Out[279]: 348 ok, bye! Just because I was curios: nec...@zakarumiy ~ % python -m timeit import test; test.prttn(25,1) 10

Re: recall function definition from shell

2010-05-18 Thread René 'Necoro' Neumann
Am 18.05.2010 20:55, schrieb superpollo: yes python does not, but maybe the *shell* does, or so i thought. i just wanted to dump the code for the function in a file, after i tested in the shell... You might want to have a look at the IPython shell [1]. I personally do not use it myself, but