r/learnpython • u/bkabartsy • Sep 26 '24
Empty strings - am i tripping?
>>> '' in 'abc'
Truecan someone explain? (python 3.12.6)
1
Upvotes
r/learnpython • u/bkabartsy • Sep 26 '24
>>> '' in 'abc'
Truecan someone explain? (python 3.12.6)
4
u/This_Growth2898 Sep 26 '24
In the string 'abc', 'b' is between 'a' and 'c'.
In the string 'ac', '' is between 'a' and 'c'.
So, 'b' in 'abc' should be as true as '' in 'ac'.