Balanced X and O
Imagine you need to check whether two symbols are balanced in a string, for a simple game or pattern check. Write a function xo that counts the letters x and o without caring about letter case. Return True if the counts are equal, otherwise return False.
Примеры
Ввод
"xo"Вывод
TrueВвод
"xxOo"Вывод
TrueВвод
"xxxm"Вывод
FalseНужно реализовать
def xo(s: str) -> bool:
Теги
strings
Log in om je inzendingsgeschiedenis te zien
InloggenLog in om de AI-mentor te gebruiken
InloggenVisible tests
1
Input
"xo"Expected
True2
Input
"xxOo"Expected
True3
Input
"xxxm"Expected
False4
Input
"ooom"Expected
False5
Input
"zzzz"Expected
True6
Input
" "Expected
TrueFocus radio
Paused · SomaFM · Fluid