Remove One Character

Removing one character from a string is common when cleaning text or fixing a typo. Write a function missing_char that takes a non-empty string s and a valid index n. Return a new string where the character at position n is removed, and all other characters stay in the same order.

Примеры

Ввод
"kitten", 1
Вывод
"ktten"
Ввод
"kitten", 0
Вывод
"itten"
Ввод
"kitten", 4
Вывод
"kittn"

Нужно реализовать

def missing_char(s: str, n: int) -> str:

Теги

strings
PostgreSQLv16

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

Visible tests
1
Input
"kitten", 1
Expected"ktten"
2
Input
"kitten", 0
Expected"itten"
3
Input
"kitten", 4
Expected"kittn"
4
Input
"chocolate", 8
Expected"chocolat"
5
Input
"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx", 8
Expected"xxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
6
Input
"kitten", 100
Expected"kitten"
Focus radio
Paused · SomaFM · Fluid