When I was going through this mission, I never questioned the character set given! I just agreed it is how it is done. Glad you asked this question, so that now I am rethinking about it.
Like mentioned by @masterryan.prof I think we have to go through the dataset to come to a conclusion how to find these bad characters. I’ve thought about it from that perspective and I think in this case it will be easier to write a specific code to find the bad character. So depending on different case we have to come up with different logic to write a code to find these so called bad characters.
After seeing this discussion, I tried to come up with a code. Here is what I thought might work in this case.
bad_char= # Empty list to store bad characters
for string in test_data: # loops through each string
for letter in string: # loops through each letter
#set=['1','2','3','4','5','6','7','8','9','0'] # we can either go through this set
#if letter not in set: # use this line if you are using the set
if ord(letter) not in range(48,58): # or we can use ord() to get ascii value of digits 0 to 9
if letter in bad_char: # checks if the letter is already added to the list
continue # if it is already added, the continue with the iteration
else: # else it appends it the list
Here you can try in two different ways, either type out a set of all accepted characters or try it with the ord() function to find the ASCII value of digits 0 to 9 which are 48 to 57.
Let me know if it helps.