# File: Erin/movingx.py # Moving X. Write a program that, given a single line input of a single string of 1 − 100 characters # (with no white space between them), prints the string with an 'X' character inserted at # the earliest position, another string with an 'X' inserted at the second earliest position, # and so forth until the original string with an 'X' postfixed is printed. # Input: Enter a string? abcd # Output: Xabcd # aXbcd # abXcd # abcXd # abcdX def main(): s = input('Enter a string? ') m = len(s) # find its length k = 0 # start find first position k=0 while k <= m : print(s[:k] + 'X' + s[k:]) #insert X in position k k = k + 1 main()