programming-examples/python/String/Python program to remove the nth index character from a nonempty string.py

7 lines
234 B
Python
Raw Normal View History

2019-11-15 12:59:38 +01:00
def remove_char(str, n):
first_part = str[:n]
last_pasrt = str[n+1:]
return first_part + last_pasrt
print(remove_char('Python', 0))
print(remove_char('Python', 3))
print(remove_char('Python', 5))