EDIT:
I solved the problem.
Here is the code:
CODE
>>> def permutate(s, stringLength):
if(stringLength != 0):
print dropOne(s, stringLength);
permutate(s, stringLength-1);
>>> def dropOne(string, n):
tempString = "";
i = 0;
while i < n:
if i != n:
tempString = string.charAt(i);
permutatedString = permutatedString + string.charAt(n);
i=i+1;
return tempString;
>>>#Test
>>> permutate("abc",3);
Traceback (most recent call last):
File "<pyshell#30>", line 1, in <module>
permutate("abc",3);
File "<pyshell#25>", line 3, in permutate
print dropOne(s, stringLength);
File "<pyshell#29>", line 7, in dropOne
tempString = string.charAt(i);
AttributeError: 'str' object has no attribute 'charAt'
As you can see I edited the functions to Python Syntex.
But still an error apears.
and one more question, the "return tempString;" is a part of the LOOP ?
This post has been edited by obNiko: 18 May, 2007 - 11:39 PM