I'd like to create a number of lists in function of the number of characters in a word. How it works:
I ask for a word; I get the length of the word; I check if the length of the word is odd or even by comparing the remainder of the division of the length by 2 to 0; If it is odd, I add a Z at the end of the word to make it even; If it isn't, the word doesn't change; Then, what I don't know how to do is how to separate this final word (that is even) into pairs of two characters, each contained in different lists.
word=input("Enter word")
wordlenght= len(word)
remainder= wordlenght%2
if remainder==0:
finalword=word
else:
finalword= word+"z"
lenghtoffinalword= len(finalword)
numberoflists= lenghtoffinalword/2
The above code works; I end up with the final word I'd like to separate into pairs that will each be stored in different lists and the number of lists necessary. What I don't get is how I can create a varying amount of lists and insert in each one of them a portion of my word.
Any help would be very appreciated. Thanks :)