Answer to Question #344418 in Python for Kiran

Question #344418

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



1
Expert's answer
2022-05-25T10:23:07-0400
str_id = input()
num = int(input())
str_id = str_id.replace('-','')
new_str_id = []
while str_id:
	new_str_id.insert(0, str_id[-num:])
	str_id = str_id[:-num]
print('-'.join(new_str_id))

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS