Add Not
Sometimes you need to add a helper word to the start of a text, but avoid accidentally adding it twice. Write a function not_string that takes a string s and returns a new string with not at the beginning. If the string already starts with not, return it unchanged.
Примеры
Ввод
"candy"Вывод
"not candy"Ввод
"x"Вывод
"not x"Ввод
"not bad"Вывод
"not bad"Нужно реализовать
def not_string(s: str) -> str:
Теги
strings
Log ind for at se indsendelseshistorik
Log indLog ind for at bruge AI-mentor
Log indVisible tests
1
Input
"candy"Expected
"not candy"2
Input
"x"Expected
"not x"3
Input
"not bad"Expected
"not bad"4
Input
""Expected
"not "5
Input
"not bad!"Expected
"not bad!"6
Input
"x!"Expected
"not x!"Focus radio
Paused · SomaFM · Fluid