Reputation: 15
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"))
Upvotes: 1
Views: 80
Reputation: 1107
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.
Upvotes: 2