Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
yield solution in Clear category for Caps Lock by oduvan
from typing import Iterable
def iter_text(text: str) -> Iterable:
is_cap = False
for char in text:
if char in ('a', 'z'):
is_cap = not is_cap
else:
yield char.upper() if is_cap else char
def caps_lock(text: str) -> str:
# your code here
return ''.join(iter_text(text))
Dec. 12, 2018
Comments: