You are doing puts
in one and just the zip
call in the other. Why do you expect them to be the same?
puts
does print each element of an array in its own line, which is what you see here. IRB by default uses inspect
to print objects. While what you see is different, the output from the zip
method in both the cases is the same.