I have a simple set that contains strings and some of those strings are numbers. (i.e. '1', '45', '5', '39').
Some of the strings have dashes (-) or plus (+) signs in them. (i.e. '55+', '1-3').
I have created a function that should parse the set and remove the digits along with removing the characters and remove any words that are capitalized.
Function:
def parse_set(s):
for word in s.copy():
word.strip('+-')
if word.istitle() or word.isdigit():
s.remove(word)
completed_set = set(filter(None, s))
return completed_set
But when I pass in a set, any regular number without any - or + are removed. But numbers that do contain the characters still remain.
I had thought that the .strip() method would take care of that?