I need to insert a string (character by character) into another string at every 3rd position For example:- string_1:-wwwaabkccgkll String_2:- toadhp Now I need to insert string2 char by char into string1 at every third position So the output must be wwtaaobkaccdgkhllp Need in Python.. even Java is ok
So i tried this
Test_str="hiimdumbiknow"
challenge="toadh"
new_st=challenge [k]
Last=list(test_str)
K=0
For i in range(Len(test_str)):
if(i%3==0):
last.insert(i,new_st)
K+=1
and the output i get thitimtdutmbtiknow
source https://stackoverflow.com/questions/74499534/python-inserting-a-string
Comments
Post a Comment