Wednesday, November 6, 2019

printing the character at even and odd positions in python

a=input("enter some string::")
print("Character of the even positions",a[::2])
print("Character of the even positions",a[1::2])


output:
enter some string::anil
Character of the even positions ai
Character of the even positions nl

No comments:

Post a Comment

python class topic video