HackerRank- Python Mutations




Read a given string, change the character at a given index and then print the modified string.



  1. def mutate_string(string, position, character):
  2. a=list(string)
  3. a[position]= character
  4. string=''.join(a)
  5. return string
  6. if __name__ == '__main__':
  7. s = input()
  8. i, c = input().split()
  9. s_new = mutate_string(s, int(i), c)
  10. print(s_new)




codesadda.com

Codesadda.com is your home of programming solutions, tutorials, video tutorials and much more. Sign Up for our weekly newsletter to get update about new content.

Like us on Facebook | Connect with us on LinkedIn | Subscribe our Channel on Youtube