[EMAIL PROTECTED]: Python is strongly typed, and it converts types automatically less often than Perl. The purpose of such strong(er) typing is to allow to catch some kind of bugs, and to make the syntax simpler, more readable, etc.
> message = "abc" > password = "z12" > scrambled = message ^ password ^ is defined among integers: >>> 55 ^ 126 73 You need more explicit code like: >>> msg = "abc" >>> pwd = "z12" >>> [ord(c1) ^ ord(c2) for c1,c2 in zip(msg, pwd)] [27, 83, 81] >>> [chr(ord(c1)^ord(c2)) for c1,c2 in zip(msg, pwd)] ['\x1b', 'S', 'Q'] >>> "".join( chr(ord(c1)^ord(c2)) for c1,c2 in zip(msg, pwd) ) '\x1bSQ' > I also wondered why this errored as well... > int(messege) > Is it not meant to convert a string to a number? You can use int to truncate a float to int, or a string containing an int to int (it accepts an optional base too): >>> int("55") 55 >>> int(5.23) 5 >>> int("5.23") Traceback ... ValueError: invalid literal for int() with base 10: '5.23' >>> int("abc") Traceback ... Bye, bearophile -- http://mail.python.org/mailman/listinfo/python-list