In Python, what is the running time to lookup whether a character or substring is present in a string?
Example:
string = 'Hello World'
char = 'W'
if char in string:
# do something
For this if condition, is the time complexity O(1) or O(S), where S is the length of the string?