you can use zip_longest
here:
from itertools import zip_longest
s1 = 'hello'
s2 = 'paul'
for c1, c2 in zip_longest(s1, s2, fillvalue=' '):
print(c1, c2)
if you are not familiar with that, don't worry, you can use your version, I have fixed it, just continue the while loop separately:
s1 = 'hello'
s2 = 'paul'
i = 0
while i < len(s1) and i < len(s2):
print(s1[i], s2[i])
i += 1
while i < len(s1):
print(s1[i], ' ')
i += 1
while i < len(s2):
print(' ', s2[i])
i += 1
output:
h p
e a
l u
l l
o
Hope that helps you, and comment if you have further questions. : )