• Feedback from user mrskhris

Question related to mission None

  Hi guys,

I'm not sure if it's a bug, since I've started learning Python only recently. However, I've checked the same example in my local version of Python (3.3.2) and also asked a friend to run the same script (Python 2.2.7), and he got the same result. CheckIO, however, claims there is a problem.

(Later edit) Perhaps, this bug report is incomplete. Let me provide you with some details:

I've run this script:
def l(a,f=[]):
 for e in a:
  if hasattr(e,"__len__"): l(e,f)
  else: f.append(e)
 return f

def flat_list(array):
    return l(array)

through tests. 
Second test fails with this error message:

Your result: [1,2,3,1,2,2,2,4]
Right result: [1,2,2,2,4]
Fail: flat_list([1,[2,2,2],4])

However, the same script run offline yields correct results.

Elena

URL from: http://www.checkio.org/mission/flatten-list/solve/
HTTP_USER_AGENT: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/34.0.1847.116 Safari/537.36