# Hackerrank Mutations problem solution in Python

In this HackerRank Mutation problem solution in python, we need to develop a program in which we can read a given input string and replace the character at a given index and then print the modified string on the output screen. here we need to use an array method.

## Problem solution in Python 2 programming.

```S=raw_input()
i,c=map(str,raw_input().split())
i=int(i)
print S[:i] + c + S[i+1:]```

## Problem solution in Python 3 programming.

```string = input()
line = input().split()
i, c = int(line[0]), line[1]
print(string[:i] + c + string[i+1:])```

### Problem solution in PyPy programming.

```# Enter your code here. Read input from STDIN. Print output to STDOUT
S=raw_input()
n,a=raw_input().split()
l=list(S)
l[int(n)]=a
print ''.join(l)```

### Problem solution in PyPy3 programming.

```#def mutate_string(string, position, character)
#print(input())
string=list(input())
[a,b]=(input().split())
#print ([a,b])
#print(string[int(a)])
#print(i)
#print(rep)
#string = string[:i] + str(b) + string[(i+1):]
string[int(a)]= str(b)
string="".join(string)
print (string)

#return```