Let's say I have a string
S='Let us start attending Stanford University Lectures'
Now if I want to have all the words that have an 's'
or 'S'
in them then the following list comprehension
[x for x in S if 'S' or 's' in x])
I get the following
['L', 'e', 't', ' ', 'u', 's', ' ', 's', 't', 'a', 'r', 't', ' ', 'a', 't', 't', 'e', 'n', 'd', 'i', 'n', 'g', ' ', 'S', 't', 'a', 'n', 'f', 'o', 'r', 'd', ' ', 'U', 'n', 'i', 'v', 'e', 'r', 's', 'i', 't', 'y', ' ', 'L', 'e', 'c', 't', 'u', 'r', 'e', 's']
but when I change the list comprehension to
[x for x in S if 'S' in x])
I get the following
['S']
Why am I getting incorrect results?