Python Program for Removing i-th Character from a String Last Updated : 12 Nov, 2025 Comments Improve Suggest changes 17 Likes Like Report Given a string and an index i, remove the character at the i-th position and return the resulting string. For Example:Input: "PythonProgramming", i = 6Output: "Pythonrogramming"Let's explore different methods to do this task.Using String SlicingThis method removes the i-th character by directly taking parts of the string before and after the character and joining them together. It is fast and memory-efficient. Python s = "PythonProgramming" i = 6 res = s[:i] + s[i+1:] print(res) OutputPythonrogramming Explanation:s[:i]: Extracts characters from the start up to (but not including) index i.s[i+1:]: Extracts characters from index i+1 to the end.'+': Concatenates the two slices, skipping the i-th character.Using join() with List ComprehensionThis method creates a new string by iterating over all characters and joining only those that are not at the i-th index. Python s = "PythonProgramming" i = 6 res = ''.join([s[j] for j in range(len(s)) if j != i]) print(res) OutputPythonrogramming Explanation:[s[j] for j in range(len(s)) if j != i]: Iterates through all indices and skips the i-th character.''.join(...): Converts the list of characters back into a string.Using replace() with SlicingThis method removes the i-th character by replacing its first occurrence with an empty string. Python s = "PythonProgramming" i = 6 res = s[:i] + s[i:].replace(s[i], '', 1) print(res) OutputPythonrogramming Explanation: s[:i] + s[i:].replace(s[i], '', 1): Removes the i-th character by joining the part before i with the remaining substring after deleting s[i].Using a For LoopThe for loop iterates over each character in the string and adds it to a new string only if it is not at the i-th position. Python s = "PythonProgramming" i = 6 res = '' for j in range(len(s)): if j != i: res += s[j] print(res) OutputPythonrogramming Explanation:for j in range(len(s)) with if j != i: Loop through all indices, skipping the i-th.res += s[j]: Concatenate characters to res one by one.Related Articles:How to Remove Letters From a String in PythonRemove character Create Quiz Program for removing i-th character from a string Comment K Kanchan_Ray Follow 17 Improve K Kanchan_Ray Follow 17 Improve Article Tags : Python python-string Python string-programs Explore Python FundamentalsPython Introduction 2 min read Input and Output in Python 4 min read Python Variables 4 min read Python Operators 4 min read Python Keywords 2 min read Python Data Types 8 min read Conditional Statements in Python 3 min read Loops in Python - For, While and Nested Loops 5 min read Python Functions 5 min read Recursion in Python 4 min read Python Lambda Functions 5 min read Python Data StructuresPython String 5 min read Python Lists 4 min read Python Tuples 4 min read Python Dictionary 3 min read Python Sets 6 min read Python Arrays 7 min read List Comprehension in Python 4 min read Advanced PythonPython OOP Concepts 11 min read Python Exception Handling 5 min read File Handling in Python 4 min read Python Database Tutorial 4 min read Python MongoDB Tutorial 3 min read Python MySQL 9 min read Python Packages 10 min read Python Modules 3 min read Python DSA Libraries 15 min read List of Python GUI Library and Packages 3 min read Data Science with PythonNumPy Tutorial - Python Library 3 min read Pandas Tutorial 4 min read Matplotlib Tutorial 5 min read Python Seaborn Tutorial 3 min read StatsModel Library - Tutorial 3 min read Learning Model Building in Scikit-learn 6 min read TensorFlow Tutorial 2 min read PyTorch Tutorial 6 min read Web Development with PythonFlask Tutorial 8 min read Django Tutorial | Learn Django Framework 7 min read Django ORM - Inserting, Updating & Deleting Data 4 min read Templating With Jinja2 in Flask 6 min read Django Templates 5 min read Build a REST API using Flask - Python 3 min read Building a Simple API with Django REST Framework 3 min read Python PracticePython Quiz 1 min read Python Coding Practice 1 min read Python Interview Questions and Answers 15+ min read Like