Remove by Index
Removing one character is often needed when cleaning text or fixing a typo. Write a function remove_nth that takes a string s and an index n. The index is always valid, so return a new string without the character at position n, keeping all other characters in the same order.
Примеры
Ввод
"python", 0Вывод
"ython"Ввод
"python", 3Вывод
"pyton"Ввод
"python", 5Вывод
"pytho"Нужно реализовать
def remove_nth(s: str, n: int) -> str:
Теги
strings
Entre para ver seu histórico de envios
EntrarEntre para usar o AI Mentor
EntrarVisible tests
1
Input
"python", 0Expected
"ython"2
Input
"python", 3Expected
"pyton"3
Input
"python", 5Expected
"pytho"4
Input
"a", 0Expected
""5
Input
"hello", 1Expected
"hllo"6
Input
"a", 1Expected
"a"Focus radio
Paused · SomaFM · Fluid