Alright, for all your coders out there...
I am currently giving you a problem in python and type the code in the answer section for this problem.
This question is based on string manipulation.
Difficulty level - 1 / 5
______________________________________________________
Let's say we have a string. For example, let's say the string is 'Brainle'. This has to be the first input:
The second line of input contains two characters. (x , y )
This says that the string 'y' will have to go in the xth place of the input string.
First case :
input = 'Brainle'
Input2 = 6, y
Then, the output should be printed as : Brainly.
Remember while solving the problem, TAKE THE INPUT BY YOUR SELF. THE INPUT TAKING SHOULD BE ON YOUR CODE!
______________________
Good luck! :)
samrudhi15:
answer @illr
Answers
Answered by
8
PROGRAM
strng = input("Enter a string : ")
pos = int(input("Enter position : "))
given_char = input("Enter character to change : ")
length = len(strng)
arr = [0] * length
i = 0
new_str = ""
if pos < length:
for char in strng:
arr[i] = char
i = i + 1
arr[pos-1] = given_char
for some in arr:
new_str = new_str + some
print("New modified String is : "+new_str)
else:
print("given position is exceding the given string length")
OUTPUT
Enter a string : rakesh
Enter position : 4
Enter character to change : q
New modified String is : rakqsh
Answered by
11
Refer the attachment.
Hey, there looking for another similar answer?
look into the attachment.
Attachments:
Similar questions