# no periods, spaces or puctuation marks
punctuation_not_wanted = [".","!", " " "/"]
for punctuation_not_wanted in s:
if punctuation_not_wanted in s:
return false
# no periods, spaces or puctuation marks
punctuation_not_wanted = [".","!", " " "/"]
for punctuation_not_wanted in s:
if punctuation_not_wanted in s:
return false
You can compare them as sets. If they have same symbols, their intersection (&) will have this same symbols and will converts to True for if statement.
if set(punctuation_not_wanted) & set(s):
return False