Python Program
Write a python program to print the following output.
Input
The first line contains a string S representing a unique id.
The second line contains an integer N representing group length.
Output
The output should be a single string representing the new unique id.
Sample Input1
2-4A0r7-4k
3
Sample Output1
24-A0R-74K
It has to be split from the end. So:
print("Enter the id")
s = input()
print("Enter group length")
n = input()
s = s.replace("-", "")
letters = list(s)
print(letters)
for i in range (len(s)-3,0,-3):
print(i)
slist.insert(i,"-")
s = ''.join(letters)
print(s)
Comments
Leave a comment