[Solved] Given a tuple t of strings, compute the tuple consisting of all strings in t containing the character @


After a couple of tryouts I just achieved to solve it:

tuple_1 = ('asdf@', 'asdf')

tuple_2 = ()

for elem in [item for item in tuple_1 if '@' in item]: tuple_2 = tuple_2 + (elem,)

print tuple_2

I hope this is what you need! I’m voting you up, since it was a little bit of fun reminding me of my math self-learning times in college.

solved Given a tuple t of strings, compute the tuple consisting of all strings in t containing the character @