Python Practice › String Programs › Program 94
Remove the kth character
Write a Python program to remove the character at index k.
Input
k = 2, "sqatools"
Output
sqtools
Approach
- Join the parts before and after index k.
Solution
text, k = "sqatools", 2print(text[:k] + text[k + 1:])Output
sqtools
Learn the concept
New to this topic? Read the lesson, then come back.