Python Day 6 : Let's Review | HackerRank 30 Days of Code Solutions


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

Code:


t = int(input())
for i in range(t):
    s = str(input())
    print (s[::2], s[1::2])

Post a Comment

Previous Post Next Post
Best Programming Books

Facebook

AJ Facebook
Checkout Our Facebook Page
AJ Blogs
Checkout Our Instagram Page