Python Day 6: Let's Review




Given a string, S , of length N that is indexed from 0 to N-1, print its even-indexed and odd-indexed characters as 2 space-separated strings on a single line (see the Sample below for more detail).

Note: 0 is considered to be an even index.



  1. # Enter your code here. Read input from STDIN. Print output to STDOUT
  2. t = int(input())
  3. for i in range(t):
  4. s = str(input())
  5. print (s[::2], s[1::2])




codesadda.com

Codesadda.com is your home of programming solutions, tutorials, video tutorials and much more. Sign Up for our weekly newsletter to get update about new content.

Like us on Facebook | Connect with us on LinkedIn | Subscribe our Channel on Youtube