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
PostgreSQLv16

Itt jelenik meg a kód futtatásának eredménye

Visible tests
1
Input
"python", 0
Expected"ython"
2
Input
"python", 3
Expected"pyton"
3
Input
"python", 5
Expected"pytho"
4
Input
"a", 0
Expected""
5
Input
"hello", 1
Expected"hllo"
6
Input
"a", 1
Expected"a"
Focus radio
Paused · SomaFM · Fluid