Write a program which will create a new string by appending s2 in the middle of s1 given two strings, s1 and s2


Topic: Write a program which will create a new string by appending s2 in the middle of s1 given two strings, s1 and s2

Solution

def appendMiddle(s1, s2):
  middleIndex = int(len(s1) /2)
  middleThree = s1[:middleIndex:]+ s2 +s1[middleIndex:]
  print("After appending new string in middle", middleThree)
  
appendMiddle("Ault", "Kelly")



List all Python Programs