-1

これは私がやろうとしている非常に単純なことであり、別のコードを書くと、powershell でも機能します。しかし、ここの私のプログラムでは、うまくいかないようです:

ここに私のコードがあります: http://ideone.com/vV5ZNS

x = list(str(raw_input("Please enter a string: ")))

y = x
z = []
i = 0
j = 1
k = -1
n = len(x)
while i<n:
    i = k + 1
    j = i + 1

    while j<n:
        x = y   #does not reassign the orignal string array to x.
        k = i
        while j<n:
            z.insert(i, x[i])
            if (x[i] == x[j]):
                j = j+1
            else:
                x[i] = x[j]
                x[j] = z[i]
                print (x)
                print "\n"
                j = j+1
                i = i+1
4

1 に答える 1