We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
I failed at a list comprehension solution and had to resort to the humble 'for' loop. Somehow it didn't occur to me that I could use an "else" like that in a list comprehension. Thanks for posting your answer!
(also, the fact that you just go straight to iterating over "raw_input", that's a neat thing)
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
sWAP cASE
You are viewing a single comment's thread. Return to all comments →
I failed at a list comprehension solution and had to resort to the humble 'for' loop. Somehow it didn't occur to me that I could use an "else" like that in a list comprehension. Thanks for posting your answer!
(also, the fact that you just go straight to iterating over "raw_input", that's a neat thing)