We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
  • HackerRank Home

    HackerRank

  • |
  • Prepare
  • Certify
  • Compete
  • Hiring developers?
  1. Prepare
  2. Python
  3. Strings
  4. Mutations
  5. Discussions

Mutations

Problem
Submissions
Leaderboard
Discussions
Editorial

Sort 881 Discussions, By:

recency

Please Login in order to post a comment

  • verdox162
    7 days ago+ 0 comments
    def mutate_string(string, position, character):
        return string[:position]+character+string[position+1:]
    
    if __name__ == '__main__':
        s = input()
        i, c = input().split()
        s_new = mutate_string(s, int(i), c)
        print(s_new)
    
    0|
    Permalink
  • shamsheerkhan055
    1 week ago+ 0 comments

    def mutate_string(string, position, character): l = list(string) l[int(i)] = c string = "".join(l) return string

    if name == 'main': s = input() i, c = input().split() s_new = mutate_string(s, int(i), c) print(s_new)

    0|
    Permalink
  • raj_shekhar_2021
    1 week ago+ 0 comments
    def mutate_string(string, position, character):
        l = list(string)
        l[position] = character
        string = "".join(l)
        return string
    
    0|
    Permalink
  • rumeysaerkus
    2 weeks ago+ 0 comments
    def mutate_string(string, position, character):
        string = list(string)
        string[int(position)] = character
        string = "".join(string)
        return string
    
    
    s = input()
    i, c = input().split()
    s_new = mutate_string(s, int(i), c)
    print(s_new)
    
    0|
    Permalink
  • shibamsinha0708
    2 weeks ago+ 0 comments

    x=input() y,z=input().split() k=int(y) x1=list(x) x1[k]=z print(''.join(x1))

    0|
    Permalink
Load more conversations

Need Help?


View editorial
View top submissions
  • Blog
  • Scoring
  • Environment
  • FAQ
  • About Us
  • Support
  • Careers
  • Terms Of Service
  • Privacy Policy