2
When doing basic programs asking for user input, and testing if it is empty with in because of another variable that defines possible inputs, I come across the following:
if '' in 'abc':
print('not ok')
else:
print('ok')
>>> not ok
and:
if '' in ['abc'] or '' in ('abc',) or '' in {'abc'}:
print('not ok')
else:
print('ok')
>>> ok
If ''/"" is present in strings in simple variables, why is it not present in strings in compound variables, or vice versa? What is the difference? Is there any explanation for this?
Link to another related question (in English), with complete answers for those who have more questions.