I am trying to slice a string and insert the components into a list (or index, or set, or anything), then compare them, such that
Input:
abba
Output:
['ab', 'ba']
Given a variable length of the input.
So if I slice a string
word = raw_input("Input word"
slicelength = len(word)/2
longword[:slicelength]
such that
list = [longwordleftslice]
list2 = [longwordrightslice]
list2 = list2[::-1 ] ## reverse slice
listoverall = list + list2
However, the built-in slice command [:i]
specifies that i
be an integer.
What can I do?