-
Notifications
You must be signed in to change notification settings - Fork 0
/
task_No1.py
29 lines (22 loc) · 922 Bytes
/
task_No1.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
def mutate_string(string, position, character):
"""
Changes the character at the given position in the string and returns the modified string.
"""
# Convert the string to a list of characters
string_list = list(string)
# Replace the character at the given position with the new character
string_list[position] = character
# Convert the list of characters back to a string
modified_string = ''.join(string_list)
return modified_string
def main():
# Read the input string, position, and character
string = input().strip()
position, character = input().strip().split()
position = int(position)
# Call the mutate_string function to get the modified string
modified_string = mutate_string(string, position, character)
# Print the modified string
print(modified_string)
if __name__ == '__main__':
main()