Skip to content

Latest commit

 

History

History

mutations

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 

Mutations

https://www.hackerrank.com/challenges/python-mutations

Problem

We have seen that lists are mutable (they can be changed), and tuples are immutable (they cannot be changed).

Let's try to understand this with an example.

You are given an immutable string, and you want to make changes to it.

Task

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

Input Format

The first line contains a string, S. The next line contains an integer i, denoting the index location and a character c separated by a space.

Output Format

Using any of the methods explained above, replace the character at index i with character c.

Sample Input 0

abracadabra
5 k

Sample Input 0

abrackdabra

My Solution