+ 3
How could I print out the same result but with better, short code?
a = "PAYPALISHIRING" i = 0 res = '' while i < len(a): res += a[i] res += ' ' i += 4 s = 1 res1 = '' while s < len(a): res1 += a[s] res1 += ' ' s += 2 t = 2 res2 = '' while t < len(a): res2 += a[t] res2 += ' ' t += 4 final = res + res1 + res2 final1 = final.split() print res print res1 print res2 final = ''.join(final1) print final
5 Respuestas
+ 4
please copy your code to code playground
+ 4
further idea
https://code.sololearn.com/ce7C0i73J3u8/?ref=app
+ 4
@Nahi nice challenge btw!
+ 2
I did 'zigzag'