0
Need help with my code
Hey guys! I've just started learning Python and I got problems with my code: https://code.sololearn.com/cljKeBNc59OU/#py When I run print(a[::2]), the sentence is not complete. But when I run print(a[1::2]), the sentence is complete. Can you guys advice on how to improve the code? Thank you very much in advance!
2 Answers
+ 2
The problem isn't with your slicing, but your use of zip(). Your strings aren't the same length so zip stops at the shorter string. If you pad fill spaces at the end of 'b' to make the strings the same length your code works fine.
https://docs.python.org/3.4/library/functions.html#zip
+ 1
Thank you very much!