So I'm trying to work to create a program which can take two inputs such as
encrypt('12345','12')
and it will return
'33557'
where the code ('12345') and been incremented by the key ('12'), working from right to left.
I have already created one which will work for when the code and key are both 8 long, but I cannot work out how to do this should the code be allowed to be any size, possibly with nested for statments?
Here is the one i did early so you can see better what i am trying to do
def code_block(char,charBlock):
if len(char) == 8 and len(charBlock) == 8: #Check to make sure both are 8 didgets.
c = char
cB = charBlock
line = ""
for i in range(0,8):
getDidget = code_char2(front(c),front(cB))
c = last(c)
cB = str(last(cB))
line =line + getDidget
print(line)
else:
print("Make sure two inputs are 8 didgets long")
def front(word):
return word[:+1]
def last(word):
return word[+1:]