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"))
Ben k
  • 15
  • 3

2 Answers2

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

Community
  • 1
  • 1
ocelot
  • 1,067
  • 12
  • 16
0

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