- Notifications
You must be signed in to change notification settings - Fork 23
Expand file tree
/
Copy pathpython-mutations.py
More file actions
Latest commit
17 lines (13 loc) · 504 Bytes
/
Copy pathpython-mutations.py
File metadata and controls
17 lines (13 loc) · 504 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
# Python > Strings > Mutations
# Understand immutable vs mutable by making changes to a given string.
#
# https://www.hackerrank.com/challenges/python-mutations/problem
#
defmutate_string(string, position, character):
returnstring[:position] +character+string[position+1:]
# (skeliton_tail) ----------------------------------------------------------------------
if__name__=='__main__':
s=input()
i, c=input().split()
s_new=mutate_string(s, int(i), c)
print(s_new)