-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmutate.py
More file actions
16 lines (11 loc) · 855 Bytes
/
mutate.py
File metadata and controls
16 lines (11 loc) · 855 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
# Program to mutate the character in the specified position
def mutate(string,position,character): # Function mutate will change or mutate the character in the specified position
convert_me = list(string)
convert_me[position] = character
con_me_back = ''.join(convert_me)
return con_me_back
s = input("Enter any string :") # Get the input string from the user
pos = int(input("Enter the position :")) # Get the input position from the user at which the character has to be mutated
char = input("Enter the character :") # Get the input character from the user to be placed at the specified position
res = mutate(s,pos,char) # Call the function mutate and pass the parameters (String,Position,Character)
print(res)