Python 3.7
# solution import string change = lambda s: "".join(['1' if c in s.lower() else '0' for c in string.ascii_lowercase]) # testcases for case in ["!!a$%&RgTT", "", "abcdefghijklmnopqrstuvwxyz", "aaaaaaaaaaa"]: print(f"change({case}) = {change(case)}")
Try it online!
(Sorry. I didn’t manage for format the code in markdown properly on my iphone)
I had roughly the same idea:
def isin(text): text = text.lower() return "".join([str(1) if letter in text else str(0) for letter in "abcdefghhijklmnopqrstuvwxyz"])
Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment's permalink.
Hide child comments as well
Confirm
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Python 3.7
Try it online!
(Sorry. I didn’t manage for format the code in markdown properly on my iphone)I had roughly the same idea: