The list constructor takes an iterable (like a string in this case) and returns a list. In your case, this should be roughly equivalent to def myList(iterator): tempList =  for i in iterator: tempList += [i] return tempList Iterating over a string will return it one char at a time, hence a == ['a', 'b', 'c'].
if you want to see what something does, just use a print function a = 'abc' a = list(a) print(a) print function is also useful for finding bugs. not sure why an if/else is returning the way it is, print what your checking and see if the output is matching your expectations. Things like that