$ ./guess_the_languageProblem Solving — fill the blank
Problem Solving — fill the blank · medium · #305

What goes in the blank?

# keep only the digits: 'a1b2' -> '12'
digits = ''.join(c for c in s if c.____())

Answer: isdigit (also accepted: isdigit, isdigit(), isdecimal, isdecimal(), isnumeric, isnumeric())

isdigit is True for digit characters, so the generator keeps just those.
Play Problem Solving ▸