1

I am trying to make a simple XOR program. Once I finished checking my syntax, I ran my program and ran into an infinite loop. I can't find my error. Help?

def disencode(n):
    seconde = raw_input("Input_Second_String")
    y = len(n)
    x = 0
    while x < y:
        if n[x] == seconde[x]:
            print 0
        else:
            print 1
        x =+1
disencode(raw_input("Input_First_String"))

2 Answers 2

2

x=+1 should be x += 1, as with your current code, you never increment x, as x =+ 1 is the same thing as x = 1.

You're effectively setting x as 1, never increasing it, and asking the loop to run while x < y, which is infinite.

See here for more information

Sign up to request clarification or add additional context in comments.

Comments

0

use x += 1 for incrementing x instead of x =+1

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.