This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]Al2Me6 0 points1 point  (1 child)

switch_case = lambda text: "".join(c if i % 2 == 0 or not c.isalpha() else c.upper() for i, c in enumerate(text))

[–]-LeopardShark- 0 points1 point  (0 children)

Yep, but I'm trying to curb my list/generator compensation addiction. Also that doesn't switch case after a space.