I have tested and used this code in python 2.4. However, as soon as I moved onto python 3.4, an error comes up - "TypeError: unsupported operand type(s) for +: 'int' and 'str'. I would greatly appreciate it if you managed to find the reason why this is happening. I will post the code I used below
alphabetL = 'abcdefghijklmnopqrstuvwxyz'
alphabetC = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
number = '0123456789'
space = ' '
Ll = len(alphabetL)
Lc = len(alphabetC)
Ln = len(number)
Lall = Ll + Lc + Ln
Question1 = input('Hello, please insert the message you want encrypted: ')
key1 = input('Please insert the key you want used [Keep between 1 and 26]: ')
cipher = ''
cipher2 = ''
for A in Question1:
if A in alphabetL:
cipher += alphabetL[(alphabetL.index(A)+key1)%Ll]
elif A in alphabetC:
cipher += alphabetC[(alphabetC.index(A)+key1)%Lc]
elif A in number:
cipher += number[(number.index(A)+key1)%Ln]
elif A in space:
cipher += space
else:
print ('Error, please use abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789')
print (cipher)