python – return and print does not give same result

Are these lines indented properly?

for ml in key:
value = myDict.get(ml, "not found"); 
re = [];
re.append(value)

I think you want it to do this:

re = []
for ml in key:
    value = myDict.get(ml, "not found")    
    re.append(value)
return '-'.join(re)

BTW no semicolons used in Python.

Leave a Comment